結果

問題 No.161 制限ジャンケン
ユーザー ThetaTheta
提出日時 2022-10-24 11:55:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 949 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 8,660 KB
最終ジャッジ日時 2023-09-15 11:39:53
合計ジャッジ時間 1,707 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 19 ms
8,620 KB
testcase_02 AC 18 ms
8,544 KB
testcase_03 AC 19 ms
8,464 KB
testcase_04 WA -
testcase_05 AC 19 ms
8,472 KB
testcase_06 AC 18 ms
8,576 KB
testcase_07 AC 19 ms
8,420 KB
testcase_08 AC 18 ms
8,552 KB
testcase_09 AC 19 ms
8,468 KB
testcase_10 AC 19 ms
8,480 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 18 ms
8,616 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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