|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||7||1||1||100.000%|
Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless.
A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows:
For example, if the hand is:
Then this hand has 13 hcp and a distribution of 5−5−2−1 (the distribution is usually listed in non−increasing order). A balanced distribution is any one of 4−3−3−3, 4−4−3−2, and 5−3−3−2.
In bridge, an opening bid is either "pass" or consists of a level (1−7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non−negative number. Multiple "x"s in a distribution are not necessarily the same.
In the example above, rule 9a applies and a bid of 1 Hearts should be made.
The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two−character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end−of−file.
For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space.
SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3 SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8 SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5
Hand #1: 1 Hearts Hand #2: 1 No Trump Hand #3: 1 Clubs