Krasimir_Slavov

WWSwimming

Sep 22nd, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 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 WWSwimming
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double record = double.Parse(Console.ReadLine());
  14.             double distance = double.Parse(Console.ReadLine());
  15.             double timeSeconds = double.Parse(Console.ReadLine());
  16.  
  17.             double totalTime = distance * timeSeconds;
  18.             double slowTime = Math.Floor(distance / 15) * 12.5;
  19.  
  20.             double Ivanrecord = totalTime + slowTime;
  21.  
  22.             if(Ivanrecord < record)
  23.             {
  24.                 Console.WriteLine($" Yes, he succeeded! The new world record is {Ivanrecord:F2} seconds.");
  25.             }
  26.             else
  27.             {
  28.                 double success = Ivanrecord - record;
  29.                 Console.WriteLine($"No, he failed! He was {Math.Abs(success):F2} seconds slower.");
  30.  
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment