結果

問題 No.161 制限ジャンケン
ユーザー Theta
提出日時 2022-10-24 11:55:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 949 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-02 15:09:34
合計ジャッジ時間 1,398 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


def main():
    G, C, P = map(int, input().split())
    S = input()

    score = 0
    for other_hand in S:
        match other_hand:
            case "G":
                if P > 0:
                    score += 3
                    P -= 1
                elif G > 0:
                    score += 1
                    G -= 1
                else:
                    C -= 1
            case "C":
                if G > 0:
                    score += 3
                    G -= 1
                elif C > 0:
                    score += 1
                    C -= 1
                else:
                    P -= 1
            case "P":
                if C > 0:
                    score += 3
                    C -= 1
                elif P > 0:
                    score += 1
                    P -= 1
                else:
                    G -= 1

    print(score)


if __name__ == "__main__":
    main()
0