Advertisement
sanyakasarova

06. Tournament of Christmas

Jun 19th, 2021
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _2._Exam_Preparation
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int days = int.Parse(Console.ReadLine());
  10.  
  11. double totalMoney = 0;
  12. int totalWins = 0;
  13. int totalLosses = 0;
  14.  
  15. for (int i = 0; i < days; i++)
  16. {
  17. double moneyForTheCurrentDay = 0;
  18. int wins = 0;
  19. int losses = 0;
  20.  
  21. string sport = Console.ReadLine();
  22.  
  23. while (sport != "Finish")
  24. {
  25. string result = Console.ReadLine();
  26.  
  27. if (result == "win")
  28. {
  29. moneyForTheCurrentDay += 20;
  30. wins++;
  31. }
  32. else
  33. {
  34. losses++;
  35. }
  36. sport = Console.ReadLine();
  37. }
  38.  
  39. if (wins > losses)
  40. {
  41. moneyForTheCurrentDay += moneyForTheCurrentDay * 0.10;
  42. totalWins++;
  43. }
  44. else
  45. {
  46. totalLosses++;
  47. }
  48.  
  49. totalMoney += moneyForTheCurrentDay;
  50. }
  51.  
  52.  
  53. if (totalWins > totalLosses)
  54. {
  55. totalMoney += 0.20 * totalMoney;
  56. Console.WriteLine($"You won the tournament! Total raised money: {totalMoney:f2}");
  57. }
  58. else
  59. {
  60. Console.WriteLine($"You lost the tournament! Total raised money: {totalMoney:f2}");
  61. }
  62.  
  63.  
  64. }
  65. }
  66. }
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement