Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _01._01._02.BasketBattle
- {
- class Program
- {
- static string OtherPleyar(string curPlayer)
- {
- return curPlayer == "Nakov" ? "Simeon" : "Nakov";
- }
- static void Main(string[] args)
- {
- string curPlayer = Console.ReadLine();
- int numOfRound_N = int.Parse(Console.ReadLine());
- Dictionary<string, int> allPoint = new Dictionary<string, int>() { { "Nakov", 0 }, { "Simeon", 0 } };
- bool isWiner = false;
- int round;
- for (round = 1; round <= numOfRound_N; round++)
- {
- string firstPlayer = curPlayer;
- int trayPoints_P = int.Parse(Console.ReadLine());
- int firstPlayerPoint = trayPoints_P;
- allPoint[firstPlayer] += Console.ReadLine() == "success" ? firstPlayerPoint : 0;
- isWiner = allPoint[curPlayer] == 500;
- if (isWiner) break;
- curPlayer = OtherPleyar(firstPlayer);
- string secondPlayer = curPlayer;
- trayPoints_P = int.Parse(Console.ReadLine());
- int secondPlayerPoint = trayPoints_P;
- allPoint[secondPlayer] += Console.ReadLine() == "success" ? secondPlayerPoint : 0;
- isWiner = allPoint[curPlayer] == 500;
- if (isWiner) break;
- allPoint[firstPlayer] -= allPoint[firstPlayer] > 500 ? firstPlayerPoint : 0;
- allPoint[secondPlayer] -= allPoint[secondPlayer] > 500 ? secondPlayerPoint : 0;
- }
- if (isWiner)
- {
- Console.WriteLine(curPlayer);
- Console.WriteLine(round);
- Console.WriteLine(allPoint[OtherPleyar(curPlayer)]);
- }
- else if (allPoint["Nakov"] == allPoint["Simeon"])
- {
- Console.WriteLine("DRAW");
- Console.WriteLine(allPoint["Nakov"]);
- }
- else
- {
- curPlayer = allPoint["Nakov"] > allPoint["Simeon"] ? "Nakov" : "Simeon";
- Console.WriteLine(curPlayer);
- Console.WriteLine(Math.Abs(allPoint["Nakov"] - allPoint["Simeon"]));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement