1838: YahtzeeScore

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:28 解决:11

题目描述

Your task is about the scoring in the first phase of the die-game Yahtzee, where five dice are used. The score is determined by the values on the upward die faces after a roll. The player gets to choose a value, and all dice that show the chosen value are considered active. The score is simply the sum of values on active dice. Say, for instance, that a player ends up with the die faces showing 2, 2, 3, 5 and 4. Choosing the value two makes the dice showing 2 active and yields a score of 2 + 2 = 4, while choosing 5 makes the one die showing 5 active, yielding a score of 5.

输入

Each line is a case. Toss will contain exactly 5 elements. Each element of toss will be between 1 and 6, inclusive.

输出

return the maximum possible score with these values.

样例输入 复制

2 2 3 5 4
6 4 1 1 3
5 3 5 3 3

样例输出 复制

5
6
10