169. TOPC 2017 PB. The Combination of Poker Cards

0 Judge

Code: 0


The Combination of Poker Cards

英文題目敘述

Poker is a popular card game worldwide, which was played from the 18th century in a variety of forms. A standard deck of poker cards has 52 cards divided into four suits, with each suit having the 13 ranks. In the Chinese area, "Big Two" and "Thirteen Cards" are two popular poker games based on the ranking of different combinations of cards. If we want to design such computer poker games, we need to write a program that can recognize card combinations. Suppose that we simplify the requirement as follows: Without considering the types of suits but only concerning about the ranks of cards, try to determine the card combination from any six given cards. If we use integer numbers to represent card ranks, the possible card combinations are described below:

  • single: six different numbers, e.g., 2 5 7 10 9 8
  • one pair: one pair of equal numbers, e.g., 4 4 7 10 8 9
  • two pairs: two pairs of equal numbers, e.g., 8 8 3 3 6 7
  • three pairs: three pairs of equal numbers, e.g., 8 8 3 3 7 7
  • one triple: three equal numbers, e.g., 2 2 2 7 5 6
  • two triples: two suits of three equal numbers, e.g., 2 2 2 7 7 7
  • tiki: four equal numbers, e.g., 5 5 5 5 9 8
  • tiki pair: four equal numbers and another one pair, e.g., 5 5 5 5 9 9
  • full house: three equal numbers and another one pair, e.g., 3 3 3 9 9 7

Suppose that we use integer numbers from 1 to 13 to represent the card ranks. Please write a program to determine the card combination from six input numbers.

英文輸入說明

The first input line contains one integer number $T$, indicating the number of test cases. Each test case includes six integer numbers (with each number from 1 to 13) that are separated by a single white space.

You may assume:

  • $1 \le T \le 25$
  • In every test case, any number appears at most 4 times.

英文輸出說明

Show the name of the card combination for each input test case using the namespace of single, one pair, two pairs, three pairs, one triple, two triples, tiki, tiki pair, and full house.

範例輸入

5
4 3 4 3 12 10
5 4 2 3 6 12
10 12 10 12 12 8
8 5 8 8 5 5
2 10 6 10 10 10

範例輸出

two pairs
single
full house
two triples
tiki

中文題目敘述

撲克牌是一種國際盛行的卡牌遊戲,有很多種玩法,據傳最早源自18世紀。標準撲克牌共52張牌,包含四種花色,每一花色共13張不同點數的牌。在華人地區盛行的撲克牌玩法有大老二和十三支,主要是比較牌型組合的大小。如果想要利用電腦設計這些撲克牌遊戲,就必須寫程式自動判斷各種牌型。假設我們簡化牌型的判斷條件如下: 在不看花色與只看牌點的條件下,每次從給定的6張牌中,決定牌型是哪一種。如果使用整數數字代表不同的牌點,則可能的牌型描述如下:

  • 單張(single): 6個數字均不相同,例如,2 5 7 10 9 8
  • 一對(one pair): 兩個數字相同,其餘均不同,例如,4 4 7 10 8 9
  • 兩對(two pairs): 兩組兩個數字相同,例如,8 8 3 3 6 7
  • 三對(three pairs): 三組兩個數字相同,例如,8 8 3 3 7 7
  • 三條(one triple): 一組三個數字相同,其餘均不同,例如,2 2 2 7 5 6
  • 雙三條(two triples): 兩組三個數字相同,例如,2 2 2 7 7 7
  • 鐵支(tiki): 四個數字相同,例如,5 5 5 5 9 8
  • 鐵支配對(tiki pair): 四個數字相同,另外還有一對數字,例如,5 5 5 5 9 9
  • 葫蘆(full house): 三個數字相同,另外還有一對數字,例如,3 3 3 9 9 7

假設使用整數數字1至13代表不同點數的牌卡,請寫一個程式從每行輸入的6個數字中判讀是以上哪一種牌型。

中文輸入說明

第一行輸入包含一個整數$T$,表示測試的牌型數量。每一個測試牌型包括6個落於1至13的整數數字,數字間用單一空格區隔。

可假設:

  • $1 \le T \le 25$
  • 不會有同一數字出現超過四次。

中文輸出說明

輸出每一行的牌型名稱,牌型名稱請用對應的英文名稱,即single、one pair、two pairs、three pairs、one triple、two triples、tiki、tiki pair或full house。


Judge Setting

run-time limit: 1000 ms
memory limit: 65536000 byte
測資數量: 0