Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CharityMarathon
- {
- public class CharityMarathon
- {
- public static void Main()
- {
- int marathonLength = int.Parse(Console.ReadLine());
- int numOfRunners = int.Parse(Console.ReadLine());
- int numLapsperRunner = int.Parse(Console.ReadLine());
- int trackLength = int.Parse(Console.ReadLine());
- int trackCapacity = int.Parse(Console.ReadLine());
- decimal moneyPerKm = decimal.Parse(Console.ReadLine());
- int capacityTotal = trackCapacity * marathonLength;
- if (capacityTotal <= numOfRunners)
- {
- numOfRunners = capacityTotal;
- }
- ulong metersTotal = (ulong)numOfRunners * (ulong)numLapsperRunner * (ulong)trackLength;
- ulong totalKm = metersTotal / 1000;
- decimal moneyTotal = totalKm * moneyPerKm;
- Console.WriteLine("Money raised: {0:f2}", moneyTotal);
- }
- }
- }
Add Comment
Please, Sign In to add comment