Pro.ID21849 TitleTichu Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21849 AC0 Submit4 Ratio0.00% 时间&空间限制描述Tichu is a card game played by four players. The players sit around a square table, and each player forms a team with the person sitting opposite him or her. The game is played with a standard deck of cards and four additional special cards. The basic rule of the game is as follows: the player who won the last trick can start a new trick with any legal combination of cards. Then, in turn, each next player can either pass or play the same combination of cards, but with a higher value. This continues until everyone passes, and at that point the player who played the last combination wins the trick and can start a new trick. The main goal is to get rid of all of your cards as soon as possible. These basic rules make it a good tactic to combine the cards in such a way that they can be played in as few combinations as possible. For simplicity we consider here a slightly modified version of the game. We ignore the special cards, so that leaves a standard deck of 52 cards, ranging over the values 2 to Ace and over the suits hearts, diamonds, clubs, and spades. The suits are indicated by the lowercase letters h, d, c, and s, while the values are indicated in increasing order by 2-9, T, J, Q, K, A. The following list is a complete set of legal combinations:
In this problem, your task is to determine the minimum number of combinations that your hand of 13 cards can be partitioned into. 输入On the first line a positive integer: the number of test cases, at most 100. After that per test case: one line that describes your hand of 13 cards. The card descriptions are separated by single spaces. A card is described by two characters: the value followed by the suit. All cards in your hand are different. 输出Description Tichu is a card game played by four players. The players sit around a square table, and each player forms a team with the person sitting opposite him or her. The game is played with a standard deck of cards and four additional special cards. The basic rule of the game is as follows: the player who won the last trick can start a new trick with any legal combination of cards. Then, in turn, each next player can either pass or play the same combination of cards, but with a higher value. This continues until everyone passes, and at that point the player who played the last combination wins the trick and can start a new trick. The main goal is to get rid of all of your cards as soon as possible. These basic rules make it a good tactic to combine the cards in such a way that they can be played in as few combinations as possible. For simplicity we consider here a slightly modified version of the game. We ignore the special cards, so that leaves a standard deck of 52 cards, ranging over the values 2 to Ace and over the suits hearts, diamonds, clubs, and spades. The suits are indicated by the lowercase letters h, d, c, and s, while the values are indicated in increasing order by 2-9, T, J, Q, K, A. The following list is a complete set of legal combinations:
In this problem, your task is to determine the minimum number of combinations that your hand of 13 cards can be partitioned into. Input On the first line a positive integer: the number of test cases, at most 100. After that per test case: one line that describes your hand of 13 cards. The card descriptions are separated by single spaces. A card is described by two characters: the value followed by the suit. All cards in your hand are different. Output Per test case:
Sample Input 2 Sample Output 4 Source 样例输入2 样例输出4 作者 |