結果

問題 No.161 制限ジャンケン
ユーザー rin204
提出日時 2022-01-20 09:15:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 378 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-11-23 14:24:35
合計ジャッジ時間 1,970 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

G, C, P = map(int, input().split())
S = input()
g = c = p = 0
for s in S:
    if s == "G":
        g += 1
    elif s == "C":
        c += 1
    else:
        p += 1
        
ans = min(G, c) * 3
G -= min(G, c)
c -= min(G, c)
ans += min(C, p) * 3
C -= min(C, p)
p -= min(C, p)
ans += min(P, g) * 3
P -= min(P, g)
g -= min(P, g)

ans += min(g, G) + min(c, C) + min(p, P)
print(ans)
0