QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB

#22975. カードゲーム

Statistics

Geunwoo は今日、面白いカードゲームを学んでいます。

カードには赤、青、黄、緑の 4 色があり、各色には 1 から 9 までの数字が書かれたカードが 9 枚ずつあります。

カードは全部で $36=4\times 9$ 枚です。このゲームでは 36 枚から 5 枚を引き、以下の規則で整数の得点を計算します。

カードの色は英大文字 R、B、Y、G で表し、それぞれ赤、青、黄、緑を意味します。例えば Y8 は黄色の 8、B5 は青色の 5 です。

得点の規則

  1. 5 枚すべてが同じ色で数字が連続する場合、最大の数字に 900 を加えた値が得点です。 例: Y4, Y3, Y2, Y5, Y6 → $906=6+900$.

  2. 5 枚のうち 4 枚の数字が同じ場合、その数字に 800 を加えます。 例: B3, R3, B7, Y3, G3 → $803=3+800$.

  3. 3 枚の数字が同じで、残りの 2 枚の数字も同じ場合、3 枚に共通する数字を 10 倍し、2 枚に共通する数字を加え、さらに 700 を加えます。 例: R5, Y5, G7, B5, Y7 → $757=5\times 10+7+700$.

  4. 5 枚すべてが同じ色の場合、最大の数字に 600 を加えます。 例: Y3, Y4, Y8, Y6, Y7 → $608=8+600$.

  5. 5 枚の数字が連続する場合、最大の数字に 500 を加えます。 例: R7, R8, G9, Y6, B5 → $509=9+500$.

  6. 5 枚のうち 3 枚の数字が同じ場合、その数字に 400 を加えます。 例: R7, Y7, R2, G7, R5 → $407=7+400$.

  7. 2 枚の数字が同じで、別の 2 枚の数字も同じ場合、重複する 2 種類の数字の大きい方を 10 倍し、小さい方を加え、さらに 300 を加えます。 例: R5, Y5, Y4, G9, B4 → $354=5\times 10+4+300$.

  8. 5 枚のうち 2 枚の数字が同じ場合、その数字に 200 を加えます。 例: R5, Y2, B5, B3, G4 → $205=5+200$.

  9. 上のいずれにも当てはまらない場合、最大の数字に 100 を加えます。 例: R1, R2, B4, B8, Y5 → $108=8+100$.

5 枚のカードが入力として与えられます。ゲームの得点を求めるプログラムを作成してください。2 つ以上の規則を適用できる場合、最も高い得点をゲームの得点とします。

入力

1 行目から 5 行目まで、各行にカードが 1 枚ずつ与えられます。色と数字の間には空白が 1 つあります。

出力

得点を 1 行に出力してください。

入出力例

入力 1

B 3
B 7
R 1
B 2
Y 7

出力 1

207

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.