Advertisement
Militsa

01. Charity Marathon

Dec 8th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 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 _01.Charity_Marathon
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var days = long.Parse(Console.ReadLine());
  14.             var numberRunners = long.Parse(Console.ReadLine());
  15.             var average = int.Parse(Console.ReadLine());
  16.             var trackLength = long.Parse(Console.ReadLine());
  17.             var trackCapasity = long.Parse(Console.ReadLine());
  18.             var moneyPerKm = decimal.Parse(Console.ReadLine());
  19.  
  20.             long maxRunners = trackCapasity * days;
  21.             long willRun = Math.Min(maxRunners, numberRunners);
  22.             long totalKm = (willRun * average * trackLength) / 1000;
  23.             decimal money = moneyPerKm * totalKm;
  24.  
  25.             Console.WriteLine("Money raised: {0:F2}", money);
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement