In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you are familiar with IRC chat, the support team is also reachable on PIRC network (irc.pirc.pl
) in #szkopul
channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
Byteman decided to spend his vacations in Byte Vegas. During his stay in the capital of gambling, he especially enjoyed the Video-Poker game. It is a game which requires a lot of thinking about the strategy. Byteman would like to win the game as many times as possible, so he asked you to write a program, which will help him achieve this goal.
In order to play Video-Poker, a standard deck of 52 cards (from Two to Ace, four suits) is needed. The game is played by only one player, who has to pay one byte-dollar for a single hand. The player is given five randomly selected cards from the deck. Afterwards, the player is allowed to exchange any number of cards. Cards that are exchanged are turned down and the player gets in return the same number of cards from the deck. At the end of the round, the player is paid a number of byte-dollars, according to the payout table. The payout depends on the set of cards the player has in his or her hand.
Following hands are distinguishable (from the weakest to the strongest):
The player is given a payout for the strongest combination of cards he has (for instance, if he has a Full House, then he also has a pair, but the payout is equal to the value of the Full House from the payout table). If the player does not have any of the cards' configurations listed above, he is not paid at all.
Byteman would like to know what is the optimal strategy (which maximizes the expected payout) for different casinos (different casinos may use different payout tables). Prove Byteman that you can calculate this strategy! Given a payout table, calculate for how many hands playing the optimal strategy one would keep all cards, for how many of them you will turn down one, two, three, four and finally five cards. If many different moves end with the same expected payout, it is required to select the move, which requires keeping the least number of cards.
Byteman gave you some payout tables from different casinos. Your task is to calculate required results for all of them. Your program can simply output precomputed values.
Write a program which:
The first and only line of the standard input defines the payout table. It contains nine positive integers, separated by single spaces. They represent payouts for a Pair, Two pairs, Three of a kind, Straight, Flush, Full House, Four of a kind, Straight Flush and Royal Flush. Your program will be tested with the following sets of input data:
In the first line of the standard output there should be integers, separated by single spaces. They represent the number of hands, for which the optimal strategy requires turning down , , , , and cards.
For the input data:
1 2 3 4 6 9 25 50 800
the correct result is:
18864 292800 147528 1651440 403968 84360
Task author: Marek Turski.