Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace BasketBattle
- {
- class Program
- {
- static void Main(string[] args)
- {
- string firstPlayer = Console.ReadLine();
- int rounds = int.Parse(Console.ReadLine());
- int firstPlay = 0;
- int secondPlay = 0;
- int roundCount = 0;
- bool firstToPlay = true;
- bool isBreak = false;
- for (int i = 0; i < rounds; i++)
- {
- int strike = int.Parse(Console.ReadLine());
- string resultOfStrike = Console.ReadLine();
- if (resultOfStrike == "success")
- {
- if (firstToPlay)
- {
- firstPlay += strike;
- if (firstPlay > 500)
- {
- firstPlay -= strike;
- }
- if (secondPlay == 500 | firstPlay == 500)
- {
- Console.WriteLine("{0}\n{1}\n{2}", firstPlayer, roundCount + 1, secondPlay);
- isBreak = true;
- break;
- }
- }
- else
- {
- secondPlay += strike;
- if (secondPlay > 500)
- {
- secondPlay -= strike;
- }
- if (secondPlay == 500 | firstPlay == 500)
- {
- if(firstPlayer=="Nakov")
- {
- Console.WriteLine("Simeon\n{0}\n{1}", roundCount + 1, firstPlay);
- }
- else
- {
- Console.WriteLine("Nakov\n{0}\n{1}", roundCount + 1, firstPlay);
- }
- isBreak = true;
- break;
- }
- }
- }
- strike = int.Parse(Console.ReadLine());//second strike
- resultOfStrike = Console.ReadLine();//second result
- if (resultOfStrike == "success")
- {
- if (firstToPlay)
- {
- secondPlay += strike;
- if (secondPlay > 500)
- {
- secondPlay -= strike;
- }
- if (secondPlay == 500 | firstPlay == 500)
- {
- if (firstPlayer == "Nakov")
- {
- Console.WriteLine("Simeon\n{0}\n{1}", roundCount + 1, firstPlay);
- }
- else
- {
- Console.WriteLine("Nakov\n{0}\n{1}", roundCount + 1, firstPlay);
- }
- isBreak = true;
- break;
- }
- }
- else
- {
- firstPlay += strike;
- if (firstPlay > 500)
- {
- firstPlay -= strike;
- }
- if (secondPlay == 500 | firstPlay == 500)
- {
- Console.WriteLine("{0}\n{1}\n{2}", firstPlayer, roundCount +1 , secondPlay);
- isBreak = true;
- break;
- }
- }
- }
- firstToPlay = !firstToPlay;
- roundCount++;
- }
- if (isBreak == false)
- {
- if (secondPlay == firstPlay)
- {
- Console.WriteLine("DRAW\n{0}", secondPlay);
- }
- else
- {
- if (firstPlay > secondPlay)
- {
- Console.WriteLine("{0}\n{1}", firstPlayer, firstPlay - secondPlay);
- }
- else
- {
- if (firstPlayer == "Nakov")
- {
- Console.WriteLine("Simeon\n{0}", secondPlay - firstPlay);
- }
- else
- {
- Console.WriteLine("Nakov\n{0}", secondPlay - firstPlay);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement