Hide

Problem G
Game of Dice

/problems/gameofdice/file/statement/en/img-0001.jpg
In the game Yatzy, the player rolls $5$ plain six-sided dice, with each face numbered from $1$ to $6$. Each roll can score in several categories:
ones:

if you have $k$ ones, you get $k$ points.

twos:

if you have $k$ twos, you get $2k$ points.

threes:

if you have $k$ threes, you get $3k$ points.

fours:

if you have $k$ fours, you get $4k$ points.

fives:

if you have $k$ fives, you get $5k$ points.

sixes:

if you have $k$ sixes, you get $6k$ points.

pair:

if you have at least two dice showing $x$, you get $2x$ points.

two pairs:

if you have at least two dice showing $x$, and at least two dice of another kind showing $y$, you get $2x + 2y$ points.

three of a kind:

if you have at least three dice showing $x$, you get $3x$ points.

four of a kind:

if you have at least four dice showing $x$, you get $4x$ points.

full house:

if you have two dice of one kind $x$, and three dice of another kind $y$, you get $2x + 3y$ points.

small straight:

if you have the numbers $1-5$, you get $15$ points.

large straight:

if you have the numbers $2-6$, you get $20$ points.

yatzy:

if you have five dice of the same kind, you get $50$ points.

chance:

you get points equal to the sum of the numbers on all the dice.

Given the results of all 5 dice, output for each category the maximum score for that category. If the roll doesn’t score in that category, print $0$ instead.

Input

The input consists of the faces of all the five dice, as shown in the sample inputs.

Ouptut

Output $15$ integers separated by whitespace – the point values of each score type. For readability, the example outputs show the first $6$ scores on one line, followed by the $11$ other types

Sample Input 1 Sample Output 1
+-------+ +-------+ +-------+ +-------+ +-------+
|       | |     o | |     o | | o   o | | o   o |
|   o   | |       | |   o   | |       | |   o   |
|       | | o     | | o     | | o   o | | o   o |
+-------+ +-------+ +-------+ +-------+ +-------+
1 2 3 4 5 0
0 0 0 0 0 15 0 0 15
Sample Input 2 Sample Output 2
+-------+ +-------+ +-------+ +-------+ +-------+
| o   o | | o   o | |     o | | o   o | |       |
|       | | o   o | |       | |       | |   o   |
| o   o | | o   o | | o     | | o   o | |       |
+-------+ +-------+ +-------+ +-------+ +-------+
1 2 0 8 0 6
8 0 0 0 0 0 0 0 17
Sample Input 3 Sample Output 3
+-------+ +-------+ +-------+ +-------+ +-------+
| o   o | | o   o | |     o | |     o | | o   o |
|   o   | |   o   | |   o   | |   o   | |   o   |
| o   o | | o   o | | o     | | o     | | o   o |
+-------+ +-------+ +-------+ +-------+ +-------+
0 0 6 0 15 0
10 16 15 0 21 0 0 0 21
Sample Input 4 Sample Output 4
+-------+ +-------+ +-------+ +-------+ +-------+
| o   o | | o   o | | o   o | | o   o | | o   o |
|   o   | |   o   | |   o   | |   o   | |   o   |
| o   o | | o   o | | o   o | | o   o | | o   o |
+-------+ +-------+ +-------+ +-------+ +-------+
0 0 0 0 25 0
10 0 15 20 0 0 0 50 25
Sample Input 5 Sample Output 5
+-------+ +-------+ +-------+ +-------+ +-------+
|     o | |     o | |     o | | o   o | |     o |
|       | |       | |       | |       | |       |
| o     | | o     | | o     | | o   o | | o     |
+-------+ +-------+ +-------+ +-------+ +-------+
0 8 0 4 0 0
4 0 6 8 0 0 0 0 12

Please log in to submit a solution to this problem

Log in