結果

問題 No.161 制限ジャンケン
ユーザー nohakai3
提出日時 2022-11-07 21:04:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,124 KB
実行使用メモリ 66,768 KB
最終ジャッジ日時 2024-07-21 04:06:23
合計ジャッジ時間 1,861 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 5 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

g,c,p=map(int,input().split())
s=list(input())
g2,c2,p2=0,0,0
for x in s:
    if x=="G":
        g2+=1
    elif x=="C":
        c2+=1
    else:
        p2+=1

l=[g2,c2,p2]
ans=0
ans+=3*min(g,c2)
ans+=3*min(c,p2)
ans+=3*min(p,g2)
g-=min(g,c2)
c-=min(c,p2)
p-=min(p,g2)
if g>0 and g2>0:
    ans+=min(g,g2)
elif c>0 and c2>0:
    ans+=(c,c2)
elif p>0 and p2>0:
    ans+=(p,p2)

print(ans)
0