Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 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 Demo
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double record = double.Parse(Console.ReadLine());
  14.             double meters = double.Parse(Console.ReadLine());
  15.             double timeForMeter = double.Parse(Console.ReadLine());
  16.  
  17.             double timeSlow = meters / 15;
  18.             int slow = (int)Math.Floor(timeSlow);
  19.             double plusTime = slow * 12.5;
  20.  
  21.             double time = plusTime + (timeForMeter * meters);
  22.             double needed = time - record;
  23.  
  24.             if (time < record)
  25.             {
  26.                 Console.WriteLine("Yes, he succeeded! The new world record is {0:F2} seconds.", time);
  27.             }
  28.  
  29.             else
  30.             {
  31.                 Console.WriteLine("No, he failed! He was {0:F2} seconds slower.", needed);
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement