結果

問題 No.161 制限ジャンケン
ユーザー zombietanzombietan
提出日時 2016-05-29 02:37:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 740 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 8,652 KB
最終ジャッジ日時 2023-08-20 04:51:27
合計ジャッジ時間 1,554 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,652 KB
testcase_01 AC 20 ms
8,484 KB
testcase_02 AC 21 ms
8,428 KB
testcase_03 AC 19 ms
8,648 KB
testcase_04 AC 19 ms
8,448 KB
testcase_05 AC 19 ms
8,464 KB
testcase_06 AC 20 ms
8,604 KB
testcase_07 AC 19 ms
8,568 KB
testcase_08 AC 19 ms
8,648 KB
testcase_09 AC 19 ms
8,480 KB
testcase_10 AC 19 ms
8,616 KB
testcase_11 AC 19 ms
8,516 KB
testcase_12 AC 18 ms
8,476 KB
testcase_13 AC 19 ms
8,648 KB
testcase_14 AC 19 ms
8,548 KB
testcase_15 AC 19 ms
8,636 KB
testcase_16 AC 19 ms
8,604 KB
testcase_17 AC 19 ms
8,484 KB
testcase_18 AC 19 ms
8,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
g, c, p = map(int, input().split())
S = input()
fg = S.count('G')
fc = S.count('C')
fp = S.count('P')
yuki = [g, c, p]
friend = [fc, fp, fg]

ans = 0
result_y = []
result_f = []
for j, k in zip(yuki, friend):
    if j > k:
        ans += k * 3
        result_y.append(j - k)
        result_f.append(0)
    elif k > j:
        ans += j * 3
        result_y.append(0)
        result_f.append(k - j)
    else:
        ans += j * 3
        result_y.append(0)
        result_f.append(0)
        
result_f = deque(result_f)       
result_f.rotate(1)
result_f = list(result_f)

for n, m in zip(result_y, result_f):
    if n > m:
        ans += m
    elif m > n:
        ans += n
    else:
        ans += n

print(ans)
0