結果

問題 No.161 制限ジャンケン
ユーザー s_shohei
提出日時 2020-09-05 11:08:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 364 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 51,968 KB
最終ジャッジ日時 2024-11-27 23:00:49
合計ジャッジ時間 1,717 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

g,c,p = list(map(int, input().split()))
hands=[c,g,p]
s = input()
ans=0
te="CGPCGP"

for i in range(len(s)):
    draw = te.find(s[i])
    win = (te.find(s[i])+1)%3
    lose = (te.find(s[i])+2)%3

    if hands[win] > 0:
        hands[win]-=1
        ans+=3
    elif hands[draw] > 0:
        hands[draw]-=1
        ans+=1
    else:
        hands[lose]-=1

print(ans)
0