結果

問題 No.161 制限ジャンケン
ユーザー brthyyjpbrthyyjp
提出日時 2021-04-12 18:46:25
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 71,628 KB
最終ジャッジ日時 2023-09-11 00:58:37
合計ジャッジ時間 2,752 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 71 ms
71,128 KB
testcase_02 AC 72 ms
71,132 KB
testcase_03 AC 71 ms
71,064 KB
testcase_04 AC 76 ms
71,012 KB
testcase_05 AC 72 ms
70,728 KB
testcase_06 AC 71 ms
70,780 KB
testcase_07 AC 71 ms
70,928 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 71 ms
70,908 KB
testcase_11 AC 73 ms
71,228 KB
testcase_12 AC 72 ms
71,164 KB
testcase_13 WA -
testcase_14 AC 72 ms
71,104 KB
testcase_15 AC 72 ms
71,100 KB
testcase_16 AC 71 ms
70,780 KB
testcase_17 AC 72 ms
70,976 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

G0, C0, P0 = map(int, input().split())
S = str(input())
G1, C1, P1 = 0, 0, 0
for c in S:
    if c == 'G':
        G1 += 1
    elif c == 'C':
        C1 += 1
    else:
        P1 += 1
ans = 0
ans += min(G0, C1)*3
G0, C1 = G0-min(G0, C1), C1-min(G0, C1)

ans += min(C0, P1)*3
C0, P1 = C0-min(C0, P1), P1-min(C0, P1)

ans += min(P0, G1)*3
P0, G1 = min(P0, G1), G1-min(P0, G1)

ans += min(G0, G1)
G0, G1 = G0-min(G0, G1), G1-min(G0, G1)

ans += min(C0, C1)
C0, C1 = C0-min(C0, C1), C1-min(C0, C1)

ans += min(P0, P1)
P0, P1 = P0-min(P0, P1), P1-min(P0, P1)

print(ans)
0