@l1ll5
2020-07-11T16:49:26.000000Z
字数 3310
阅读 946
——by l1ll5
2 seconds 、256 megabytes
Fujiwara no Mokou
and Houraisan Kaguya
do not want to play ping-pong today, they have decided to play Texas hold'em
.
Now let me intruduce one of the simplified rule of Texas hold'em
.
For a deck of Poker Cards,there are 52 cards.And each card have two states: pips and suits.
Pips are used to compare two cards, there 13 kinds of pips(A,K,Q,J,10,9,8,7,6,5,4,3,2).
And there are 4 kinds of suits:diamonds (♦), clubs (♣), hearts (♥) and spades (♠)。
Which means, there aren't two cards with same pips and suits in a match.
For one match of two players, there are 9 differents cards.
Each player have two pocket cards
at the beginning of the match.And only himself/herself knows what they are.
Then the Dealer(who host the game) will deal a flop : show 3 face-up community cards.And after the betting round, deal the turn and the river : another 2 face-up community cards.
When the community cards are all shown, the players show there pocket cards
and choose 5 cards in the 7 cards(2 pocket cards + 5 community cards)to construct the Hand
.
After that, compare your Hand
with another player,the player who has bigger Hand values
will win the game.
For all the possible types of Hand
, the following table shows the possible Hand values in increasing order.
same
suit.If a Hand
match many kinds of Hand values above, now we consider it as the bigger one.
The Hand
with bigger values is absolutely bigger,for the Hands with the same value, we compare them with the following rules.
And there are two points need to pay attention to.
Some cases to get better understanding.
A A A 3 3
Q Q Q 3 3
7 8 9 10 J
K K K 4 3
9 9 4 7 10
9 9 4 7 8
5 6 8 9 K
5 6 9 J Q
A K Q J 10
1 2 3 4 5
Fujiwara no Mokou
have already know the two pocket cards of herself and Houraisan Kaguya
, and the first 3 community cards are already shown.
If the following 2 community cards are chosen randomly
, Fujiwara no Mokou
wants to know the possibility of she can win the match.
Note:Draw isn't win.
The first line contains a positive integer () , indicates there are T test cases.
For one card, there are 2 characters to describe it.
The first character: one of S H D C
, indicates the suit.
The second: one of A K Q J T 1-9
,T is 10, indicates the pips.
For one test case, contains 3 lines.
The first line:the two pocket cards of Fujiwara no Mokou
.
The second line:the two pocket cards of Houraisan Kaguya
.
The third line:the three community cards already shown.
For each test case, output a number in the range of 0 to 1, indicates the answer.
If the difference between your answer and the std's answer is lower than , your answer is correct.