Advertisement
GogoK

BasketBattle

Mar 29th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.19 KB | None | 0 0
  1. using System;
  2.  
  3. class BasketBattle
  4. {
  5.     static void Main()
  6.     {
  7.         string inputName = Console.ReadLine();
  8.         string[] names = { "Simeon", "Nakov" };
  9.  
  10.         if (names[0] != inputName)
  11.         {
  12.             Array.Reverse(names);
  13.         }
  14.  
  15.         int rounds = int.Parse(Console.ReadLine());
  16.         int maxScores = 500;
  17.  
  18.         int amountPoint = 0;
  19.         string successful = "";
  20.  
  21.         int resultFirstPlayer = 0;
  22.         int resultSecondPlayer = 0;
  23.         int count = 1;
  24.  
  25.         for (int i = 0; i < rounds; i++)
  26.         {
  27.             if (i % 2 == 0)
  28.             {
  29.                 amountPoint = int.Parse(Console.ReadLine());
  30.                 successful = Console.ReadLine();
  31.                 if (successful == "success")
  32.                 {
  33.                     resultFirstPlayer += amountPoint;
  34.                 }
  35.  
  36.                 amountPoint = int.Parse(Console.ReadLine());
  37.                 successful = Console.ReadLine();
  38.                 if (successful == "success")
  39.                 {
  40.                     resultSecondPlayer += amountPoint;
  41.                 }
  42.             }
  43.             else
  44.             {
  45.                 amountPoint = int.Parse(Console.ReadLine());
  46.                 successful = Console.ReadLine();
  47.                 if (successful == "success")
  48.                 {
  49.                     resultSecondPlayer += amountPoint;
  50.                 }
  51.  
  52.                 amountPoint = int.Parse(Console.ReadLine());
  53.                 successful = Console.ReadLine();
  54.                 if (successful == "success")
  55.                 {
  56.                     resultFirstPlayer += amountPoint;                    
  57.                 }
  58.             }
  59.            
  60.             if (resultFirstPlayer >= maxScores || resultSecondPlayer >= maxScores)
  61.             {
  62.                 if (resultFirstPlayer >= 500)
  63.                 {
  64.                     Console.WriteLine("{0}", names[0]);
  65.                     Console.WriteLine("{0}", count);
  66.                     Console.WriteLine("{0}", resultSecondPlayer);
  67.                     return;
  68.                 }
  69.                 else if (resultSecondPlayer >= 500)
  70.                 {
  71.                     Console.WriteLine("{0}", names[1]);
  72.                     Console.WriteLine("{0}", count);
  73.                     Console.WriteLine("{0}", resultFirstPlayer);
  74.                     return;
  75.                 }
  76.             }
  77.             count++;
  78.         }
  79.  
  80.         if (resultFirstPlayer == resultSecondPlayer)
  81.         {
  82.             Console.WriteLine("DRAW");
  83.             Console.WriteLine("{0}", resultFirstPlayer);
  84.         }
  85.         else
  86.         {
  87.             if (resultFirstPlayer > resultSecondPlayer)
  88.             {
  89.                 Console.WriteLine("{0}", names[0]);
  90.                 Console.WriteLine("{0}", resultFirstPlayer - resultSecondPlayer);
  91.             }
  92.             else
  93.             {
  94.                 Console.WriteLine("{0}", names[1]);
  95.                 Console.WriteLine("{0}", resultSecondPlayer - resultFirstPlayer);
  96.             }
  97.         }
  98.     }
  99. }
  100.  
  101. /*
  102. 1*
  103.  
  104. Simeon
  105. 3
  106. 300
  107. success
  108. 200
  109. fail
  110. 400
  111. success
  112. 200
  113. success
  114.  
  115.  
  116. 2*
  117.  
  118. Nakov
  119. 3
  120. 150
  121. success
  122. 100
  123. fail
  124. 150
  125. success
  126. 50
  127. success
  128. 150
  129. success
  130. 70
  131. success
  132.  
  133. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement