Advertisement
Spocoman

Mountain Run

Nov 26th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MountainRun
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double record = double.Parse(Console.ReadLine());
  10.             double meters = double.Parse(Console.ReadLine());
  11.             double secondPerMeter = double.Parse(Console.ReadLine());
  12.  
  13.             double sum = meters * secondPerMeter + Math.Floor(meters/50) * 30;
  14.             if (sum < record)
  15.             {
  16.                 Console.WriteLine($" Yes! The new record is {sum:F2} seconds.");
  17.             }
  18.             else
  19.             {
  20.                 Console.WriteLine($"No! He was {sum - record:F2} seconds slower.");
  21.             }
  22.         }
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement