結果

問題 No.161 制限ジャンケン
ユーザー nohakai3nohakai3
提出日時 2022-11-07 21:10:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 311 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 71,548 KB
最終ジャッジ日時 2023-09-28 09:36:54
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,456 KB
testcase_01 AC 68 ms
71,448 KB
testcase_02 AC 70 ms
71,184 KB
testcase_03 AC 70 ms
71,308 KB
testcase_04 AC 76 ms
71,176 KB
testcase_05 AC 70 ms
71,300 KB
testcase_06 AC 69 ms
71,132 KB
testcase_07 AC 70 ms
71,112 KB
testcase_08 AC 69 ms
71,548 KB
testcase_09 AC 69 ms
71,240 KB
testcase_10 AC 71 ms
71,304 KB
testcase_11 AC 69 ms
71,068 KB
testcase_12 AC 69 ms
71,280 KB
testcase_13 AC 72 ms
71,524 KB
testcase_14 AC 71 ms
71,184 KB
testcase_15 AC 70 ms
71,452 KB
testcase_16 AC 70 ms
71,240 KB
testcase_17 AC 72 ms
71,112 KB
testcase_18 AC 70 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

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
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