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;
- namespace _03.Poker
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] deck = new int[15, 1];
- for (int i = 0; i < 5; i++)
- {
- string str = Console.ReadLine();
- if (str == "J")
- {
- deck[11, 0]++;
- }
- else if (str == "Q")
- {
- deck[12, 0]++;
- }
- else if (str == "K")
- {
- deck[13, 0]++;
- }
- else if (str == "A")
- {
- deck[14, 0]++;
- deck[1, 0]++;
- }
- else
- {
- int card = int.Parse(str);
- deck[card, 0]++;
- }
- }
- int triple = 0;
- int pair = 0;
- int straight = 0;
- for (int j = 2; j < 15; j++)
- {
- if (deck[j, 0] == 5)
- {
- Console.WriteLine("Impossible");
- return;
- }
- else if (deck[j, 0] == 4)
- {
- Console.WriteLine("Four of a Kind");
- return;
- }
- else if (deck[j, 0] == 3)
- {
- triple++;
- }
- else if (deck[j, 0] == 2)
- {
- pair++;
- }
- }
- if (triple == 1 && pair == 1)
- {
- Console.WriteLine("Full House");
- return;
- }
- else if (pair == 2)
- {
- Console.WriteLine("Two Pairs");
- return;
- }
- else if (triple == 1 && pair == 0)
- {
- Console.WriteLine("Three of a Kind");
- return;
- }
- else if (pair == 1 && triple == 0)
- {
- Console.WriteLine("One Pair");
- return;
- }
- for (int k = 1; k < 11; k++)
- {
- straight = 0;
- for (int m = 0; m < 5; m++)
- {
- if (deck[k + m, 0] == 1)
- {
- straight++;
- }
- }
- if (straight == 5)
- {
- Console.WriteLine("Straight");
- return;
- }
- }
- Console.WriteLine("Nothing");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement