Advertisement
Guest User

Swimmer

a guest
May 24th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Swimmer
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double recordinseconds = double.Parse(Console.ReadLine());
  10. double distanceinm = double.Parse(Console.ReadLine()); //преобразувах данните в double
  11. double swimingtime = double.Parse(Console.ReadLine());
  12.  
  13. double Ivansrequiredtime = distanceinm * swimingtime;
  14. double waterreistance = Math.Floor(distanceinm / 15) * 12.5;// при смятането ги закръгляваме надолу..това даде 100/100 в judge
  15. double Ivanstime = Ivansrequiredtime + waterreistance;
  16.  
  17. if (Ivanstime < recordinseconds)
  18. {
  19. Console.WriteLine($"Yes, he succeeded! The new world record is {Ivanstime:F2} seconds.");
  20. }
  21.  
  22. else if (Ivanstime >= recordinseconds)
  23. {
  24. Console.WriteLine($"No, he failed! He was {Math.Abs(recordinseconds - Ivanstime):F2} seconds slower.");
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement