MARINA_GREBENAROVA

World Swimming Record

Sep 23rd, 2021
853
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace WorldSwimmingRecord
  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 timePerMeter = double.Parse(Console.ReadLine());
  12.  
  13.             double distanceTime = distance * timePerMeter;
  14.             double resistance = Math.Floor(distance / 15) * 12.5;
  15.  
  16.             double totalTime = distanceTime + resistance;
  17.  
  18.             if (record<=totalTime)
  19.             {
  20.                 Console.WriteLine($"No, he failed! He was {totalTime-record:F2} seconds slower.");
  21.                
  22.             }
  23.             else
  24.             {
  25.                 Console.WriteLine($" Yes, he succeeded! The new world record is {totalTime:F2} seconds.");
  26.             }
  27.  
  28.  
  29.  
  30.  
  31.         }
  32.     }
  33. }
  34.  
RAW Paste Data