Guest User

Untitled

a guest
Apr 5th, 2020
1,828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Christmas_Tournament
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int dayCount = int.Parse(Console.ReadLine());
  10.  
  11. int dayWin = 0;
  12. int dayLose = 0;
  13. double allProfit = 0;
  14.  
  15. for (int i = 1; i <= dayCount; i++)
  16. {
  17. int countWinGames = 0;
  18. int countLoseGames = 0;
  19. double dayProfit = 0;
  20. while (true)
  21. {
  22. string input = Console.ReadLine();
  23. if (input == "Finish")
  24. {
  25. break;
  26. }
  27. string result = Console.ReadLine();
  28. if (result == "win")
  29. {
  30. countWinGames++;
  31. dayProfit += 20;
  32. }
  33. else if (result == "lose")
  34. {
  35. countLoseGames++;
  36. }
  37. }
  38. if (countWinGames > countLoseGames)
  39. {
  40. dayProfit *= 1.1;
  41. dayWin++;
  42. }
  43. else
  44. {
  45. dayLose++;
  46. }
  47. allProfit += dayProfit;
  48. }
  49. if (dayWin > dayLose)
  50. {
  51. allProfit *= 1.2;
  52. Console.WriteLine($"You won the tournament! Total raised money: {allProfit:F2}");
  53. }
  54. else
  55. {
  56. Console.WriteLine($"You lost the tournament! Total raised money: {allProfit:F2}");
  57. }
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment