Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- string[] cardDeck = new string[13];
- int[] cardDeckValue = new int[13];
- cardDeck[0] = "2"; /*------------------>*/ cardDeckValue[0] = 10;
- cardDeck[1] = "3"; /*------------------>*/ cardDeckValue[1] = 9;
- cardDeck[2] = "4"; /*------------------>*/ cardDeckValue[2] = 8;
- cardDeck[3] = "5"; /*------------------>*/ cardDeckValue[3] = 7;
- cardDeck[4] = "6"; /*------------------>*/ cardDeckValue[4] = 6;
- cardDeck[5] = "7"; /*------------------>*/ cardDeckValue[5] = 5;
- cardDeck[6] = "8"; /*------------------>*/ cardDeckValue[6] = 4;
- cardDeck[7] = "9"; /*------------------>*/ cardDeckValue[7] = 3;
- cardDeck[8] = "10"; /*------------------>*/ cardDeckValue[8] = 2;
- cardDeck[9] = "A"; /*------------------>*/ cardDeckValue[9] = 1;
- cardDeck[10] = "J"; /*------------------>*/ cardDeckValue[10] = 11;
- cardDeck[11] = "Q"; /*------------------>*/ cardDeckValue[11] = 12;
- cardDeck[12] = "K"; /*------------------>*/ cardDeckValue[12] = 13;
- int peshoCurrentScores = 0;
- int goshoCurrentScores = 0;
- int peshoScores = 0;
- int goshoScores = 0;
- int peshoGamesWon = 0;
- int goshoGamesWon = 0;
- while (N > 0)
- {
- // VKARVAME KARTITE NA PESHO I GOSHO
- string peshoCard1 = Console.ReadLine();
- string peshoCard2 = Console.ReadLine();
- string peshoCard3 = Console.ReadLine();
- string goshoCard1 = Console.ReadLine();
- string goshoCard2 = Console.ReadLine();
- string goshoCard3 = Console.ReadLine();
- //RESTARTIRAME MOMENTNITE IM STOINOSTI
- peshoCurrentScores = 0;
- goshoCurrentScores = 0;
- for (int i = 0; i < 13; i++)
- {
- if (cardDeck[i] == peshoCard1)
- {
- peshoCurrentScores += cardDeckValue[i];
- }
- if (cardDeck[i] == goshoCard1)
- {
- goshoCurrentScores += cardDeckValue[i];
- }
- }
- for (int i = 0; i < 13; i++)
- {
- if (cardDeck[i] == peshoCard2)
- {
- peshoCurrentScores += cardDeckValue[i];
- }
- if (cardDeck[i] == goshoCard2)
- {
- goshoCurrentScores += cardDeckValue[i];
- }
- }
- for (int i = 0; i < 13; i++)
- {
- if (cardDeck[i] == peshoCard3)
- {
- peshoCurrentScores += cardDeckValue[i];
- }
- if (cardDeck[i] == goshoCard3)
- {
- goshoCurrentScores += cardDeckValue[i];
- }
- }
- if (peshoCurrentScores > goshoCurrentScores)
- {
- peshoScores += peshoCurrentScores;
- peshoGamesWon++;
- }
- if (goshoCurrentScores > peshoCurrentScores)
- {
- goshoScores += goshoCurrentScores;
- goshoGamesWon++;
- }
- N--;
- }
- if (peshoScores > goshoScores)
- {
- Console.WriteLine("Firts player wins !");
- Console.WriteLine("Score: {0}", peshoScores);
- Console.WriteLine("Games won: {0}", peshoGamesWon);
- }
- if (goshoScores > peshoScores)
- {
- Console.WriteLine("Second player wins !");
- Console.WriteLine("Score: {0}", goshoScores);
- Console.WriteLine("Games won: {0}", goshoGamesWon);
- }
- if (goshoScores == peshoScores)
- {
- Console.WriteLine("It's a tie !");
- Console.WriteLine("Score: {0}", goshoScores);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement