Advertisement
Alexander_B

World Swimming Record

Jan 27th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DomashnoWorldSwimmingRecord
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. // get data - WR in seconds, MetersToSwim, SpeedSecondsPerMeter
  14.  
  15. double WorldRecordInSecond = double.Parse(Console.ReadLine());
  16. double MetersToSwim = double.Parse(Console.ReadLine());
  17. double SpeedSecondsPerMeter = double.Parse(Console.ReadLine());
  18.  
  19. // calculate DelayResistanceSeconds
  20.  
  21. double DelayResistanceSeconds = (Math.Floor(MetersToSwim / 15)) * 12.5;
  22.  
  23. // calculate TimeWithDelay
  24.  
  25. double TimeWithDelayInSeconds = SpeedSecondsPerMeter * MetersToSwim + DelayResistanceSeconds;
  26.  
  27. // Print Result with Message
  28.  
  29. if (TimeWithDelayInSeconds >= WorldRecordInSecond)
  30. {
  31. Console.WriteLine($"No, he failed! He was {TimeWithDelayInSeconds - WorldRecordInSecond:F2} seconds slower.");
  32. }
  33. else
  34. {
  35. Console.WriteLine($"Yes, he succeeded! The new world record is {TimeWithDelayInSeconds:F2} seconds.");
  36. }
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement