|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||27||23||23||85.185%|
Snooker is a cue sport played by two players on a rectangular table. The players take turns to pot a series of balls of varying colours, where each colour represents a distinct point value for potting the ball.
A player may pot any ball on the table initially, however any subsequent shots must follow a pattern: if the previous ball was red, the next ball must be another colour; otherwise, if there are still red balls left, the next ball must be red.
Balls of any colour other than red are initially replaced on the table every time they are potted, and may be used again to score more points. The balls stop being replaced once all of the red balls have been potted.
The values of each coloured ball are:
Snooker players are respected universally for their prowess in mental arithmetic. One sweeping glance across the table is enough to tell an experienced contestant how much they could score.
For newer players, however, this is a challenge. Write a program to help calculate a score for a given list of balls remaining on the table.
The list of balls will not be ordered in any way and will contain at most one of each of yellow, green, brown, blue, pink and black.
Output the largest possible score the player can make.
5 red black pink red red
3 blue black pink
8 yellow green brown red red red red red
2 red red