Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.97 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 BasketBattle
  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. int firstPlay = 0;
  17. int secondPlay = 0;
  18. int roundCount = 0;
  19. bool firstToPlay = true;
  20. bool isBreak = false;
  21. for (int i = 0; i < rounds; i++)
  22. {
  23. int strike = int.Parse(Console.ReadLine());
  24. string resultOfStrike = Console.ReadLine();
  25. if (resultOfStrike == "success")
  26. {
  27. if (firstToPlay)
  28. {
  29. firstPlay += strike;
  30. if (firstPlay > 500)
  31. {
  32. firstPlay -= strike;
  33. }
  34. if (secondPlay == 500 | firstPlay == 500)
  35. {
  36. Console.WriteLine("{0}\n{1}\n{2}", firstPlayer, roundCount + 1, secondPlay);
  37. isBreak = true;
  38. break;
  39. }
  40. }
  41. else
  42. {
  43. secondPlay += strike;
  44. if (secondPlay > 500)
  45. {
  46. secondPlay -= strike;
  47. }
  48. if (secondPlay == 500 | firstPlay == 500)
  49. {
  50. if(firstPlayer=="Nakov")
  51. {
  52. Console.WriteLine("Simeon\n{0}\n{1}", roundCount + 1, firstPlay);
  53. }
  54. else
  55. {
  56. Console.WriteLine("Nakov\n{0}\n{1}", roundCount + 1, firstPlay);
  57. }
  58. isBreak = true;
  59. break;
  60. }
  61. }
  62. }
  63.  
  64. strike = int.Parse(Console.ReadLine());//second strike
  65. resultOfStrike = Console.ReadLine();//second result
  66. if (resultOfStrike == "success")
  67. {
  68. if (firstToPlay)
  69. {
  70. secondPlay += strike;
  71. if (secondPlay > 500)
  72. {
  73. secondPlay -= strike;
  74. }
  75. if (secondPlay == 500 | firstPlay == 500)
  76. {
  77. if (firstPlayer == "Nakov")
  78. {
  79. Console.WriteLine("Simeon\n{0}\n{1}", roundCount + 1, firstPlay);
  80. }
  81. else
  82. {
  83. Console.WriteLine("Nakov\n{0}\n{1}", roundCount + 1, firstPlay);
  84. }
  85. isBreak = true;
  86. break;
  87. }
  88. }
  89. else
  90. {
  91. firstPlay += strike;
  92. if (firstPlay > 500)
  93. {
  94. firstPlay -= strike;
  95. }
  96. if (secondPlay == 500 | firstPlay == 500)
  97. {
  98. Console.WriteLine("{0}\n{1}\n{2}", firstPlayer, roundCount +1 , secondPlay);
  99. isBreak = true;
  100. break;
  101. }
  102. }
  103. }
  104. firstToPlay = !firstToPlay;
  105. roundCount++;
  106. }
  107. if (isBreak == false)
  108. {
  109. if (secondPlay == firstPlay)
  110. {
  111. Console.WriteLine("DRAW\n{0}", secondPlay);
  112. }
  113. else
  114. {
  115. if (firstPlay > secondPlay)
  116. {
  117. Console.WriteLine("{0}\n{1}", firstPlayer, firstPlay - secondPlay);
  118. }
  119. else
  120. {
  121. if (firstPlayer == "Nakov")
  122. {
  123. Console.WriteLine("Simeon\n{0}", secondPlay - firstPlay);
  124. }
  125. else
  126. {
  127. Console.WriteLine("Nakov\n{0}", secondPlay - firstPlay);
  128. }
  129. }
  130. }
  131. }
  132.  
  133. }
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement