結果

問題 No.161 制限ジャンケン
ユーザー cormoran
提出日時 2016-02-23 21:22:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 519 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-30 04:49:42
合計ジャッジ時間 1,227 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
G, C, P = list(map(int,input().split()))
S = input()
eG = 0
eC = 0
eP = 0
ans = 0
for c in S:
    if c == 'G' :
        if P > 0 :
            ans += 3
            P -= 1
        else :
            eG += 1
    if c == 'C' :
        if G > 0 :
            ans += 3
            G -= 1
        else :
            eC += 1
    if c == 'P' :
        if C > 0 :
            ans += 3
            C -= 1
        else :
            eP += 1
ans += min(eG, G)
ans += min(eC, C)
ans += min(eP, P)

print(ans)
0