#P1734. The Grand Tournament

The Grand Tournament

题目描述

Texas Hold'em is one of the most popular variants of the poker game. And Toilet-Ares is in a tournament of Texas Hold'em. Please read the following rules carefully as they may be different from the regular rules.

Two cards, known as hole cards, are dealt face-down to each player. Each player knows his own hole cards. And then five community cards are dealt face-up. All players know the face-up cards that are dealt. All cards are drawn from a standard 52-card deck. A standard 52-card deck comprises 13 ranks in each of the four French suits: clubs (C), diamonds (D), hearts (H), and spades (S). Each suit includes an Ace (A), a King (K), a Queen (Q), and a Jack (J), each of which is depicted alongside a symbol of its suit; and numerals or pip cards from Deuce (Two) to Ten, depicting many symbols (pips) of their suits.

Individual cards are ranked from high to low as follows: A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2. Each player seeks the best five-card poker hand from any combination of the seven cards --- the five community cards and his two hole cards.

The following table shows the possible five-card poker hand types in \ extbf{increasing}$​ order of their values. Each type has a specific ordering of the five cards described below.

 extbf[HighCard]\ extbf{[High Card]}​​ Simplest value of cards. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5​ such that a1>a2>a3>a4>a5a_1 > a_2 > a_3 > a_4 > a_5​​. (aia_i​​ represents the rank of i-th card, the same below)  extbf[OnePair]\ extbf{[One Pair]}​​ Two cards with the same rank. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5​ such that a1=a2a_1 = a_2​​, a3>a4>a5a_3 > a_4 > a_5​​, a1 ea3a_1\ e a_3​​, a1 ea4a_1\ e a_4​​, a1 ea5a_1 \ e a_5​​.  extbf[Twopairs]\ extbf{[Two pairs]}​​ Two different pairs instead of one. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5​ such that a1=a2a_1 = a_2​​, a3=a4a_3 = a_4​​, a1>a3a_1 > a_3​​, a1 ea5a_1 \ e a_5​​, a3 ea5a_3 \ e a_5​​.  extbf[ThreeofaKind]\ extbf{[Three of a Kind]}​​ Three cards with the same rank. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5​ such that a1=a2=a3a_1 = a_2 = a_3​, a4>a5a_4 > a_5​, a1 ea4a_1 \ e a_4​, a1 ea5a_1 \ e a_5​.  extbf[Straight]\ extbf{[Straight]}​ Five cards in consecutive decreasing rank, not of the same suit. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5​ such that aia_i​ is exactly one rank above ai+1a_{i+1}​ for all 1leile41 \\le i \\le 4​. Note that if a5a_5​ is Ace, a4a_4​ can be 2. In this particular case, Ace is considered one rank below 2.  extbf[Flush]\ extbf{[Flush]}​ Five cards of the same suit, not in consecutive decreasing rank. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5​ such that a1>a2>a3>a4>a5a_1 > a_2 > a_3 > a_4 > a_5.  extbf[FullHouse]\ extbf{[Full House]} Combination of Three of a Kind and One Pair. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5 such that a1=a2=a3a_1 = a_2 = a_3, a4=a5a_4 = a_5.  extbf[FourofaKind]\ extbf{[Four of a Kind]} Four cards of the same rank. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5 such that a1=a2=a3=a4a_1 = a_2 = a_3 = a_4.  extbf[StraightFlush]\ extbf{[Straight Flush]} Straight of the same suit. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5 such that aia_iai is exactly one rank above ai+1a_{i+1} for all 1leile41\\le i \\le 4. Note that if a5a_5 is Ace, a4a_4 can be 2. In this particular case, Ace is considered one rank below 2.  extbf[RoyalFlush]\ extbf{[Royal Flush]} Straight Flush from Ten to Ace. The cards are ordered as a1a2a3a4a5a_1a_2a_3a_4a_5​​​ such that a1,a2,a3,a4,a5a_1, a_2, a_3, a_4, a_5 are Ace, King, Queen, Jack, Ten of the same suit.

To compare two hands, first, we compare the type of two hands. For example, one hand is Four of a Kind, the other hand is Full House, Four of a Kind always win Full House.

If the types of two hands are the same, we compare the ranks of the cards. We will order the card as described above and compare them one by one. Firstly, we will compare the first card. If a hand's first card has a higher rank, it wins. If the first cards of the two hands have the same rank, we will compare the second card, and so on. If the cards have the same rank in every position, no one wins. The suit of cards never matters. For example,  extttS5,D5,H5,S2,C2\ exttt{S5,D5,H5,S2,C2} can win  extttD3,S3,H3,DA,HA\ exttt{D3,S3,H3,DA,HA}. Since they are both Full House, and we will compare the ranks of the three cards of a kind at first.

Consider the case that the hole cards of Alice are  extttCA,D4\ exttt{CA,D4} and the hole cards of Bob are  extttH2,S3\ exttt{H2,S3}. The community cards are  extttSA,H4,D5,CQ,HQ\ exttt{SA,H4,D5,CQ,HQ}​. The best hand of Alice (five cards among her hole cards and the community hards) is  extttCA,SA,CQ,HQ,D5\ exttt{CA,SA,CQ,HQ,D5}, which is Two Pairs. The best hand of Bob is  extttD5,H4,S3,H2,SA\ exttt{D5,H4,S3,H2,SA}, which is Straight. Thus, Bob wins.

Toilet-Ares, as a tournament participant, is facing an extremely large pot now. There are five more opponents on the table. The only thing he knows is his hole cards and the five community cards. Assuming his opponents' hole cards are uniformly distributed among the remaining cards at random, Toilet-Ares hopes to know the possibility of winning the pot.

输入格式

The first line contains two strings representing Toilet-Ares's hole cards.

The second line contains five strings representing the community cards.

For each card, the first character of its corresponding string denotes its rank. Possible ranks are  exttt2\ exttt{2} to  exttt9\ exttt{9},  extttT\ exttt{T}  extttJ\ exttt{J},  extttQ\ exttt{Q},  extttK\ exttt{K}, and  extttA\ exttt{A}, where  extttT\ exttt{T} denotes 10. The second character denotes its suit:  extttC\ exttt{C} is club,  extttD\ exttt{D} is diamond,  extttH\ exttt{H} is heart, and  extttS\ exttt{S} is spade.

It is guaranteed that each card appears at most once.

输出格式

Print a simple fraction in a single line, representing the answer. If numerator is 0, please print "0/1".

样例

DA HA 
SA CA H2 D3 C4
1/1
DA HK 
SA CA H2 S3 S4
81309405029/334969665030
D2 H2 
SA CA HA DA S4
0/1

提示

来自:2021牛客暑期多校训练营8

搬运by FrankOu