시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 57 | 17 | 11 | 23.404% |
As a child, Colleen loved the game “Yahtzee”. In Yahtzee, a player rolls 13 sets of five dice and assigns each set to various categories, which give points towards a cumulative total. This is a one-to-one matching, meaning that each set can only count for a single category and each category can only contribute points from a single set. This means that each category will be used exactly once, and each set of rolls will be used exactly once.
Now that Colleen has become an experienced programmer, she wants to determine the maximum possible score that she could achieve from a given set of dice rolls. Often times in Yahtzee, a player is allowed to select dice to re-roll; Colleen chose to ignore this rule to make things easier for herself.
The categories to assign dice roll sets in standard Yahtzee are as follows.
If the sum of the above six categories is at least 63, an additional 35-point bonus is added to the total.
The first line of input is the number of test cases that follow. Each test case contains 13 lines of 5 integers each, where each line represents the five dice rolled in a single set. Each dice roll is between 1 and 6, indicating the value that appeared on that die.
For each case output “Case x:” where x is the case number, on a single line, followed by a space, followed by the maximum Yahtzee score possible with these dice roll sets.
2 5 4 2 6 1 1 4 5 2 6 5 3 2 5 1 3 5 3 6 2 1 3 6 4 6 6 4 2 3 4 3 3 4 5 6 1 2 3 3 3 6 6 6 3 2 1 4 5 3 2 5 3 2 3 3 1 1 1 1 2 2 4 2 5 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Case 1: 154 Case 2: 110