Advertisement
StoyanGrigorov

Shit Run

Oct 24th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 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. using System.Numerics;
  7. //01. Charity Marathon
  8. namespace CharityMarathon
  9. {
  10. class CharityMarathon
  11. {
  12. static void Main(string[] args)
  13. {
  14. decimal marathonDays = decimal.Parse(Console.ReadLine());
  15. decimal runners = decimal.Parse(Console.ReadLine());
  16. decimal laps = decimal.Parse(Console.ReadLine());
  17. decimal lapLength = decimal.Parse(Console.ReadLine());
  18. decimal trackCap = decimal.Parse(Console.ReadLine());
  19. decimal moneyPerKm = decimal.Parse(Console.ReadLine());
  20.  
  21. decimal maxRunners = trackCap * marathonDays;
  22. decimal participants = 0;
  23. if (runners < maxRunners)
  24. {
  25. participants = runners;
  26. }
  27. else
  28. {
  29. participants = maxRunners;
  30. }
  31.  
  32. decimal meters = participants * laps * lapLength;
  33.  
  34. decimal kilometers = meters / 1000;
  35.  
  36. decimal totalMoney = kilometers * moneyPerKm;
  37.  
  38. Console.WriteLine($"Money raised: {totalMoney:f2}");
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement