Advertisement
bacco

Charity Marathon

Jun 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace test
  6. {
  7.     class MainClass
  8.     {
  9.         public static void Main(string[] args)
  10.  
  11.         {
  12.             var marathonDays   = long.Parse(Console.ReadLine());
  13.             var runners        = long.Parse(Console.ReadLine());
  14.             var avarLapsRunner = long.Parse(Console.ReadLine());
  15.             var trackLentght   = long.Parse(Console.ReadLine());
  16.             var capacity       = long.Parse(Console.ReadLine());
  17.             var moneyPerKm     = double.Parse(Console.ReadLine());
  18.  
  19.             var maxRunners = capacity * marathonDays;
  20.             runners  = Math.Min(maxRunners, runners);
  21.  
  22.             var totalMeters = trackLentght * avarLapsRunner * runners;
  23.             var totalKm = totalMeters / 1000.0;
  24.  
  25.             var money = totalKm * moneyPerKm;
  26.  
  27.             Console.WriteLine($"Money raised: {money:f2}");
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement