Untitled
raw download clone
CSHARP
views 22
,
size 1088 b
using System;

namespace WorldSwimmingRecord
{
    class Program
    {
        static void Main(string[] args)
        {
            double recordInSeconds = double.Parse(Console.ReadLine());
            double distanceInMeter = double.Parse(Console.ReadLine());
            double timeInSecundesSwim1Meter = double.Parse(Console.ReadLine());
            double timeForSwimmer = distanceInMeter * timeInSecundesSwim1Meter;
            double slowingSwim =Math.Floor(distanceInMeter / 15);
            double slowingTime = slowingSwim * 12.5;
            double fullTime = timeForSwimmer + slowingTime;

            if (recordInSeconds < fullTime)
            {
                double neededTime = recordInSeconds - fullTime;
                Console.WriteLine($"No, he failed! He was {(neededTime) * (-1):f2} seconds slower.");





            }           
            else
            {
                Console.WriteLine($"Yes, he succeeded! The new world record is {fullTime:f2} seconds.");
            }
                          

        }
    }
}
close fullscreen
Login or Register to edit or fork this paste. It's free.