結果

問題 No.161 制限ジャンケン
ユーザー JunOnuma
提出日時 2017-06-22 11:26:11
言語 Python2
(2.7.18)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 370 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2024-11-30 05:11:26
合計ジャッジ時間 929 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
g,c,p = map(int, raw_input().split())
ct = Counter(raw_input())
x = min(g, ct['C'])
g = max(0, g-x)
ct['C'] = max(0, ct['C']-x)
y = min(c, ct['P'])
c = max(0, c-y)
ct['P'] = max(0, ct['P']-y)
z = min(p, ct['G'])
p = max(0, p-z)
ct['G'] = max(0, ct['G']-z)
w = min(g, ct['G'])
w += min(c, ct['C'])
w += min(p, ct['P'])
print (x+y+z)*3 + w
0