結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
![]() |
提出日時 | 2016-05-29 02:37:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 740 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-30 04:53:24 |
合計ジャッジ時間 | 1,510 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
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)