結果

問題 No.161 制限ジャンケン
ユーザー lloyzlloyz
提出日時 2023-06-11 22:56:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 71,712 KB
最終ジャッジ日時 2023-08-31 02:07:44
合計ジャッジ時間 3,531 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 72 ms
71,480 KB
testcase_02 AC 73 ms
71,660 KB
testcase_03 AC 72 ms
71,144 KB
testcase_04 WA -
testcase_05 AC 71 ms
71,312 KB
testcase_06 AC 71 ms
71,468 KB
testcase_07 AC 69 ms
71,456 KB
testcase_08 AC 71 ms
71,400 KB
testcase_09 AC 72 ms
71,328 KB
testcase_10 AC 73 ms
71,388 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 72 ms
71,452 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()

n = g + c + p
ans = 0
for i in range(n):
    if s[i] == 'G':
        if p > 0:
            ans += 3
            p -= 1
        elif g > 0:
            ans += 1
            g -= 1
        else:
            c -= 1
    elif s[i] == 'C':
        if g > 0:
            ans += 3
            g -= 1
        elif c > 0:
            ans += 1
            c -= 1
        else:
            p -= 1
    else:
        if c > 0:
            ans += 3
            c -= 1
        elif p > 0:
            ans += 1
            p -= 1
        else:
            g -= 1
print(ans)
0