結果

問題 No.161 制限ジャンケン
ユーザー tnodinotnodino
提出日時 2022-07-17 14:16:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-09-12 02:13:36
合計ジャッジ時間 1,861 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
7,812 KB
testcase_02 AC 15 ms
7,788 KB
testcase_03 AC 15 ms
7,808 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,920 KB
testcase_06 AC 15 ms
7,856 KB
testcase_07 AC 15 ms
7,920 KB
testcase_08 AC 17 ms
7,916 KB
testcase_09 AC 15 ms
7,824 KB
testcase_10 AC 15 ms
7,848 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 15 ms
7,944 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

G,C,P = map(int,input().split())
S = input()
ans = 0
for s in S:
    if s == 'G':
        if P:
            ans += 3
            P -= 1
        elif G:
            ans += 1
            G -= 1
        else:
            C -= 1
    if s == 'C':
        if G:
            ans += 3
            G -= 1
        elif C:
            ans += 1
            C -= 1
        else:
            P -= 1
    if s == 'P':
        if C:
            ans += 3
            C -= 1
        elif P:
            ans += 1
            P -= 1
        else:
            G -= 1
print(ans)
0