Advertisement
nnikolov

Untitled

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