Input
The input will contain several test cases. First line of the input is the an integer which indicate the number of test case followed by a blank line. Each consecutive test case will also separated by a blank line.
Each test case gets 25 cards, 5 cards per line. Each card consists of two characters. The first represents the rank of the card: A',
2’, 3',
4’, 5',
6’, 7',
8’, 9',
X’, J',
Q’, K'. The second represents the suit of the card:
S’, H',
D’, `C’.
The cards are dealt into a tex2html_wrap_inline44 square. Each row and column is evaluated to determine the highest hand type for which its 5 cards qualify. The hand types, from low to high, are Nothing, Pair, Two Pair, Three of a Kind, Straight, Flush, Full House, Four of a Kind, Straight Flush. A hand qualifies only once, and then only for its highest type. For example, a Four of a Kind does not count as two pair or three of a kind.
Output
For each test case output a list of 9 integers, telling how many hands of each handtype were found. from lowest to highest, being:
Nothing: does not qualify as any of the following. Example: AC, 3H, QS, JD, 7D.
One Pair: contains two cards of the same rank and does not qualify for any of the following. Example: 2C, 3H, 4H, 2H, KD.
Two Pair: contains two cards of one rank and two cards of another and does not qualify for any of the following. Example: 2C, 3H, 4H, 2H, 4D.
Three of a Kind: contains three cards of the same rank and does not qualify for any of the following. Example: QS, KH, 2C, QD, QC.
Straight: the five cards of the hand may be sorted on rank so that an unbroken sequence of 5 ranks is formed and the hand does not qualify for any of the following. There can be cycle through Ace. That is AC, 2H, 4D, 3H, 5S forms a straight, as does JH, XD,QC, KD, AS and QC, KD, AS, 2H, 3D.
Flush: the five cards are all of the same suit and the hand does not qualify for any of the following. Example: 5D, AD, KD, 7D, QD.
Full House: the hand contains three cards of one rank and two cards of another. Example: 3C, QS, QD, 3H, 3S.
Four of a kind: the hand contains four cards of the same rank. Example: AS, AD, AH, 7C, AC.
Straight Flush: the hand meets the criteria for being both a straight and a flush.
Two consecutive output will separated by a blank line.
For the example below, the five rows evaluate to Straight Flush, Straight, Pair, Flush, Three of a Kind. The Five columns evaluate to Four of A Kind, Full House, Two Pair, Nothing, and Two Pair.
Sample Input
|
|
Sample Output
|
|
Solution
一張撲克牌有花色(Clubs, Diamonds, Hearts, Spades,分別以C,D,H,S來代表)及點數(2,3,4,5,6,7,8,9,10, jack, queen, king, ace,分別以2,3,4,5,6,7,8,9,X,J,Q,K,A來代表)。有一種常見的撲克牌遊戲叫”梭哈”(就是你在電影賭神中常見的那種遊戲),每個人手上有5張牌,並且依照以下的規則給予每手牌1-9的整數值。注意:每手牌只能有一個值(高的那一個),例如:Four of a kind就不能算為two pairs 或 three of a kind.
- Nothing:(中文翻譯:不知道,就是最爛的就是了)沒有以下任何情況就屬於nothing。例如:AH 9D 7C 3H 2D
- One pair:(中文翻譯:1對)有2張牌同一個點數,另3張牌皆不同點數。例如:8H 8D KC 5H 2D
- Two pairs:(中文翻譯:2對)有2組2張牌同一個點數,另1張牌不同點數。例如:8H 8D 5C 5H 9D
- Three of a kind:(中文翻譯:3條)3張牌同一個點數,另2張牌不同點數。例如:8H 8D 8C AH 9D
- Straight:(中文翻譯:順子)5張牌的點數為連續的並且可以A連接2成一圈。(所以:點數T J Q K A是順子,A 2 3 4 5是順子,Q K A 2 3也是順子)例如:8H 9H TH JH QD
- Flush:(中文翻譯:同花)5張牌同一花色。例如:6H 9H TH JH QH
- Full House:(中文翻譯:葫蘆)3張同一點數,另2張同一點數。例如:8H 8D 8C 7S 7D
- Four of a kind:(中文翻譯:4條或鐵枝)4張牌同一個點數。例如:8H 8D 8C 8S 9D
- Straight flush: (中文翻譯:同花順)5張牌同一花色,並且形成一個順子。例如:8H 9H TH JH QH
給你25張牌排成5*5的樣子。你的任務就是算出5列(橫的)及5欄(直的)這10手牌所形成的統計結果。
依序判斷,只能硬暴。
|
|