Advertisement
zh_stoqnov

Basket Battle

Mar 30th, 2015
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Basket
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string player = Console.ReadLine();
  14. int rounds = int.Parse(Console.ReadLine());
  15. int simeonScore = 0;
  16. int nakovScore = 0;
  17. int round = 0;
  18. string winner = "";
  19. int loserPoints = 0;
  20.  
  21. for (int i = 0; i < rounds * 2; i++)
  22. {
  23. int points = int.Parse(Console.ReadLine());
  24. string info = Console.ReadLine();
  25.  
  26. if (i % 2 == 0)
  27. {
  28. if (player == "Simeon")
  29. {
  30. player = "Simeon";
  31. }
  32. else
  33. {
  34. player = "Nakov";
  35. }
  36. }
  37. else
  38. {
  39. if (player == "Simeon")
  40. {
  41. player = "Nakov";
  42. }
  43. else
  44. {
  45. player = "Simeon";
  46. }
  47. }
  48.  
  49.  
  50.  
  51. if (info == "success" && player == "Simeon")
  52. {
  53. simeonScore += points;
  54. if (simeonScore > 500)
  55. {
  56. simeonScore -= points;
  57. }
  58. }
  59. if (info == "success" && player == "Nakov")
  60. {
  61. nakovScore += points;
  62. if (nakovScore > 500)
  63. {
  64. nakovScore -= points;
  65. }
  66. }
  67.  
  68. if (simeonScore == 500 || nakovScore == 500)
  69. {
  70. round = i / 2 + 1;
  71. break;
  72. }
  73.  
  74. }
  75.  
  76. if (nakovScore == 500 || simeonScore == 500)
  77. {
  78. if (nakovScore == 500)
  79. {
  80. winner = "Nakov";
  81. loserPoints = simeonScore;
  82. }
  83. else if (simeonScore == 500)
  84. {
  85. winner = "Simeon";
  86. loserPoints = nakovScore;
  87. }
  88. Console.WriteLine(winner);
  89. Console.WriteLine(round);
  90. Console.WriteLine(loserPoints);
  91. }
  92. else if (simeonScore != 500 && nakovScore != 500 && simeonScore == nakovScore)
  93. {
  94. Console.WriteLine("DRAW");
  95. Console.WriteLine(nakovScore);
  96. }
  97. else if (simeonScore != 500 && nakovScore != 500 && nakovScore != simeonScore)
  98. {
  99. if (nakovScore > simeonScore)
  100. {
  101. Console.WriteLine("Nakov");
  102. }
  103. else
  104. {
  105. Console.WriteLine("Simeon");
  106. }
  107. Console.WriteLine(Math.Abs(simeonScore - nakovScore));
  108. }
  109. }
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement