Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06.WorldSwimmingRecord
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- double worldRecordd = double.Parse(Console.ReadLine());
- double distanceInMeter = double.Parse(Console.ReadLine());
- double timeInSecondsForMetres = double.Parse(Console.ReadLine());
- double distanceToSwimInSecond = distanceInMeter * timeInSecondsForMetres;
- double waterResistance = Math.Floor(distanceInMeter / 15);
- double addedTime = waterResistance * 12.5;
- double finalTimeForSwim = distanceToSwimInSecond + addedTime;
- bool isRecordBeat = finalTimeForSwim < worldRecordd;
- if (isRecordBeat)
- {
- Console.WriteLine($"Yes, he succeeded! The new world record is {finalTimeForSwim:F2} seconds.");
- }
- else
- {
- double neededSeconds = Math.Abs(worldRecordd - finalTimeForSwim);
- Console.WriteLine($"No, he failed! He was {neededSeconds:F2} seconds slower.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement