結果

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

ソースコード

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