Under construction

Still being built. Things may change

Poker

Time limit2sMemory limit128 MB

Summary
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.

  1. High card: when no other hand type is present, the highest single card is used.
  2. One pair: two cards have the same rank.
  3. Two pair: there are two different pairs of equal-ranked cards.
  4. Three of a kind: three cards have the same rank.
  5. Straight: five cards have consecutive ranks.
  6. Back straight: the straight A, 2, 3, 4, 5.
  7. Mountain: the straight A, K, Q, J, 10.
  8. Flush: five cards have the same suit.
  9. Full house: a three of a kind and a one pair, using different ranks.
  10. Four of a kind: four cards have the same rank.
  11. Straight flush: five cards of the same suit have consecutive ranks.
  12. 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.

Examples1

  1. Example 1

    Input
    Expected output
    1005/3094
    486537/1017926
    24354/195755
    1408/39151
    14103/1017926
    9/4606
    9/4606
    25724/2544815
    228/27965
    3/4165
    207/2544815
    1/108290