Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class GFG
  5. {
  6. public static void Main()
  7. {
  8. var games = int.Parse(Console.ReadLine());
  9. var totalWins = 0;
  10. var totalLoses = 0;
  11. var totalSum = 0.0;
  12. for (int i = 0; i < games; i++)
  13. {
  14. var wins = 0;
  15. var loses = 0;
  16. var daySum = 0.0;
  17. do
  18. {
  19. var terminate = Console.ReadLine();
  20. if (terminate == "Finish") { break; }
  21.  
  22. var other= Console.ReadLine();
  23. if (other=="win")
  24. {
  25. wins++;
  26. }
  27. else
  28. {
  29. loses++;
  30. }
  31. } while (true);
  32. if (wins>loses)
  33. {
  34. daySum += 20 * wins;
  35. daySum += daySum * 0.1;
  36. totalWins++;
  37. }
  38. else
  39. {
  40. daySum += 20 * wins;
  41. totalLoses++;
  42. }
  43. totalSum += daySum;
  44. }
  45.  
  46. if (totalWins>totalLoses)
  47. {
  48. totalSum+= totalSum * 0.2;
  49. Console.WriteLine($"You won the tournament! Total raised money: {totalSum:f2}");
  50. }
  51. else
  52. {
  53. Console.WriteLine($"You lost the tournament! Total raised money: {totalSum:f2}");
  54. }
  55.  
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement