Poker
Time limit2sMemory limit128 MB
Compute the exact probability of each of 12 six-card poker hand rankings, including custom back straight and royal straight flush definitions, as reduced fractions.
- Level
Medium6 of 10
- Topics
- Combinatorics, Brute force, Math, Simulation
- Solved
- No attempts yet
Problem
Poker is played by comparing the strongest hand type that can be made from the cards a player holds.
The hand types, from weakest to strongest, are as follows.
- High card: when no other hand type is present, the highest single card is used.
- One pair: two cards have the same rank.
- Two pair: there are two different pairs of equal-ranked cards.
- Three of a kind: three cards have the same rank.
- Straight: five cards have consecutive ranks.
- Back straight: the straight
A, 2, 3, 4, 5. - Mountain: the straight
A, K, Q, J, 10. - Flush: five cards have the same suit.
- Full house: a three of a kind and a one pair, using different ranks.
- Four of a kind: four cards have the same rank.
- Straight flush: five cards of the same suit have consecutive ranks.
- Royal straight flush: the straight flush
A, 2, 3, 4, 5.
There is a standard deck of 52 cards. It has four suits, called tree, club, spade, and moon here, and each suit contains cards with ranks A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K.
In this problem, the game is six-card poker. You receive 6 cards, and you must compute the probability that each hand type is the strongest hand type that can be made.
If some subset of the cards makes a stronger hand type, weaker hand types in the same 6-card hand are ignored. Therefore, the probabilities of the 12 hand types sum to 1.
Find the probability of each hand type.
Input
No input is given.
Output
Print the probabilities of the hand types in the order listed above, one per line. Each line must be a reduced fraction in the form a/b.
Hint
In ordinary poker, a royal straight flush is often A, K, Q, J, 10 of the same suit. In this problem, follow the definition given above: the royal straight flush is A, 2, 3, 4, 5 of the same suit.