Advertisement
Guest User

basket

a guest
Mar 30th, 2015
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 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 ConsoleApplication1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string firstPlayer = Console.ReadLine();
  14. int rounds = int.Parse(Console.ReadLine());
  15.  
  16. string secondPlayer = "";
  17. if (firstPlayer == "Simeon")
  18. {
  19. secondPlayer = "Nakov";
  20. }
  21. else
  22. {
  23. secondPlayer = "Simeon";
  24. }
  25.  
  26. int simeonScore = 0;
  27. int nakovScore = 0;
  28. for (int round = 0; round < rounds; round++)
  29. {
  30. for (int i = 0; i < 2; i++)
  31. {
  32. int points = int.Parse(Console.ReadLine());
  33. string success = Console.ReadLine();
  34. if (success == "success")
  35. {
  36. if (i == 0)
  37. {
  38. if (firstPlayer == "Simeon")
  39. {
  40. if (points + simeonScore <= 500)
  41. {
  42. simeonScore += points;
  43. }
  44. if (simeonScore == 500)
  45. {
  46. Console.WriteLine("Simeon\n{0}\n{1}", (round + 1), nakovScore);
  47. Environment.Exit(0);
  48. }
  49. }
  50. else
  51. {
  52. if (points + nakovScore <= 500)
  53. {
  54. nakovScore += points;
  55. }
  56. if (nakovScore == 500)
  57. {
  58. Console.WriteLine("Nakov\n{0}\n{1}", (round + 1), simeonScore);
  59. Environment.Exit(0);
  60. }
  61. }
  62. }
  63. else
  64. {
  65. if (secondPlayer == "Simeon")
  66. {
  67. if (points + simeonScore <= 500)
  68. {
  69. simeonScore += points;
  70. }
  71. if (simeonScore == 500)
  72. {
  73. Console.WriteLine("Simeon\n{0}\n{1}", (round + 1), nakovScore);
  74. Environment.Exit(0);
  75. }
  76. }
  77. else
  78. {
  79. if (points + nakovScore <= 500)
  80. {
  81. nakovScore += points;
  82. }
  83. if (nakovScore == 500)
  84. {
  85. Console.WriteLine("Nakov\n{0}\n{1}", (round + 1), simeonScore);
  86. Environment.Exit(0);
  87. }
  88. }
  89. }
  90. }
  91. }
  92.  
  93. if (simeonScore == 500)
  94. {
  95. Console.WriteLine("Simeon\n{0}\n{1}", (round + 1), nakovScore);
  96. Environment.Exit(0);
  97. }
  98. else if (nakovScore == 500)
  99. {
  100. Console.WriteLine("Nakov\n{0}\n{1}", (round + 1), simeonScore);
  101. Environment.Exit(0);
  102. }
  103.  
  104. if (firstPlayer == "Simeon")
  105. {
  106. firstPlayer = "Nakov";
  107. secondPlayer = "Simeon";
  108. }
  109. else
  110. {
  111. firstPlayer = "Simeon";
  112. secondPlayer = "Nakov";
  113. }
  114.  
  115. }
  116.  
  117. if (simeonScore == nakovScore)
  118. {
  119. Console.WriteLine("DRAW\n{0}", simeonScore);
  120. //Environment.Exit(0);
  121. }
  122. else
  123. {
  124. if (simeonScore > nakovScore)
  125. {
  126. Console.WriteLine("Simeon\n{0}", (simeonScore - nakovScore));
  127. }
  128. else
  129. {
  130. Console.WriteLine("Nakov\n{0}", (nakovScore - simeonScore));
  131. }
  132. }
  133. }
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement