結果

問題 No.161 制限ジャンケン
コンテスト
ユーザー nohakai3
提出日時 2022-11-07 21:10:37
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 311 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 306 ms
コンパイル使用メモリ 85,116 KB
実行使用メモリ 53,524 KB
最終ジャッジ日時 2026-04-03 03:21:02
合計ジャッジ時間 3,271 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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
ans=3*min(g,c2)+3*min(c,p2)+3*min(p,g2)
ans+=min(max(0,g2-p),max(0,g-c2))
ans+=min(max(0,c2-g),max(0,c-p2))
ans+=min(max(0,p2-c),max(0,p-g2))

print(ans)
0