Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double record = double.Parse(Console.ReadLine());
  10. double distance = double.Parse(Console.ReadLine());
  11. double secsperm = double.Parse(Console.ReadLine());
  12.  
  13. if (record >= 0 && distance >= 0 && secsperm >= 0)
  14. {
  15.  
  16.  
  17. double allsecs = distance * secsperm;
  18. double timesslowed = Math.Round(distance / 15);
  19. double secsfinal = allsecs + (timesslowed * 12.5);
  20.  
  21.  
  22.  
  23.  
  24. if (secsfinal < record)
  25. {
  26. Console.WriteLine($"Yes, he succeeded! The new world record is {secsfinal:F2} seconds.");
  27. }
  28. else if (secsfinal >= record)
  29. {
  30. double secsslower = secsfinal - record;
  31. Console.WriteLine($"No, he failed! He was {secsslower:F2} seconds slower.");
  32. }
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement