Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. int days =int.Parse(Console.ReadLine()); // Read that number from console.
  8.  
  9. double totalMoneyWon = 0;
  10. int totalDaysYourAreWinner = 0;
  11. int totalDaysYouAreLoser = 0;
  12. for (int i = 0; i < days; i++)
  13. {
  14. string command = Console.ReadLine(); // Read that string from console.
  15.  
  16. int gamesWonForADay = 0;
  17. int gamesLostForADay = 0;
  18.  
  19. while (command != "Finish")
  20. {
  21. string sport = Console.ReadLine();// Read that string from console.
  22. string outcome = Console.ReadLine(); // Read that string from console.
  23.  
  24. if (outcome == "win")
  25. {
  26. gamesWonForADay++;
  27. }
  28. else
  29. {
  30. gamesLostForADay++;
  31. }
  32.  
  33. command = Console.ReadLine(); // Read that string from console.
  34. }
  35.  
  36. double moneyWonForADay = gamesWonForADay * 20;
  37.  
  38.  
  39.  
  40. if (gamesWonForADay > gamesLostForADay)
  41. {
  42. totalDaysYourAreWinner++;
  43. moneyWonForADay += (moneyWonForADay * 0.10) ;
  44. }
  45. else
  46. {
  47. totalDaysYouAreLoser++;
  48. }
  49.  
  50. totalMoneyWon += moneyWonForADay;
  51. }
  52.  
  53. if (totalDaysYourAreWinner > totalDaysYouAreLoser)
  54. {
  55. totalMoneyWon = totalMoneyWon + (totalMoneyWon* 0.2);
  56. Console.WriteLine($"You won the tournament! Total raised money: {totalMoneyWon}");
  57. }
  58. else
  59. {
  60. Console.WriteLine($"You lost the tournament! Total raised money: {totalMoneyWon}");
  61. }
  62.  
  63.  
  64.  
  65. }
  66.  
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement