petarkobakov

Tournament of Christmas

May 2nd, 2020
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Tournament_of_Christmas
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int days = int.Parse(Console.ReadLine());
  10. int win = 0;
  11. int loss = 0;
  12. double donations = 0;
  13.  
  14. for (int currentDay = 1; currentDay <= days; currentDay++)
  15. {
  16. string sport = Console.ReadLine();
  17. int dayWins = 0;
  18. int dayLosses = 0;
  19. double dayDonations = 0;
  20. while (sport != "Finish")
  21. {
  22. string result = Console.ReadLine();
  23.  
  24. if (result == "win")
  25. {
  26. dayWins++;
  27. win++;
  28. dayDonations += 20;
  29. }
  30. else if (result == "lose")
  31. {
  32. dayLosses++;
  33. loss++;
  34. }
  35. sport = Console.ReadLine();
  36. }
  37. if (sport == "Finish")
  38. {
  39. if (dayWins> dayLosses)
  40. {
  41. dayDonations += dayDonations * 0.10;
  42. donations += dayDonations;
  43. }
  44. else
  45. {
  46. donations += dayDonations;
  47. }
  48. }
  49. }
  50. if (win>loss)
  51. {
  52. donations += donations * 0.20;
  53. Console.WriteLine($"You won the tournament! Total raised money: {donations:f2}");
  54. }
  55. else if (win<loss)
  56. {
  57. Console.WriteLine($"You lost the tournament! Total raised money: {donations:f2}");
  58. }
  59. }
  60. }
  61. }
Add Comment
Please, Sign In to add comment