Advertisement
Somo4k

06. Tournament of Christmas

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