#AI2401. Rings(中级)
Rings(中级)
Description
ACSL Rings is a 3-player game where the object is to score points by tossing a ball through at least one of the 5 rings. Points are awarded as follows:
- Through the aqua or red ring - 1 point
- Through the orange or green ring - 3 points
- Through the black ring - 6 points
- Through the space where 2 rings overlap - the sum of the points for the 2 rings plus 1
We will use a single letter to represent each of the above colors: aqua (A), red (R), orange (O), green (G) and black (B). The overlapping areas will be given by 2 letters in the order shown:
- aqua and orange (AO)
- orange and black (OB)
- black and green (BG)
- green and red (GR)
You will be given 3 strings representing each player’s results for all tosses that go through at least one ring. The result of each toss will be separated by a single space.
Input Format
The input will consist of 3 strings as described above. Each string will be no longer than 100 characters.
Output Format
Output the 3 players’ scores in descending order separated by a single space. If any of the players have the same score, it doesn’t matter which one of the tied scores appears first.
Explanation
Example 1: Input:
GR A B
OB BG AO O
R G
Explanation:
- Player 1's tosses go through the green & red overlap (GR), aqua (A), and black (B) rings.
- GR score = 3 (Green) + 1 (Red) + 1 (Bonus) = 5
- A score = 1
- B score = 6
- Total = 5 + 1 + 6 = 12.
- Player 2 has a score of (3+6+1) + (6+3+1) + (1+3+1) + 3 = 28.
- OB = 10, BG = 10, AO = 5, O = 3. Total = 28.
- Player 3 has a score of 1 + 3 = 4.
- R = 1, G = 3. Total = 4.
The output is the string 28 12 4, the scores in descending order.
GR A B
OB BG AO O
R G
28 12 4
A R O G B
A A B B
R O B
14 14 10
AO OB B G A B BG GR
R R G G AO AO BG BG B
AO GR A B R G O BG OB
46 44 44
A A A B B R O O O O
BG BG GR GR O O O A B
BG BG GR GR O O O B B G
54 46 28
A B B O O G AO OB GR BG
GR GR BG BG OB AO AO
B B B G G G A A A GR AO
52 50 40
GR BG OB AO A G B
A O B AO GR GR BG O GR AO
O O B G A A GR OB AO BG
48 47 40