結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
|
提出日時 | 2024-05-25 08:40:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 48 ms / 5,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 482 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-12-20 19:34:47 |
合計ジャッジ時間 | 2,567 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
G, C, P = map(int, input().split()) S = input().rstrip() EG, EC, EP = 0, 0, 0 for s in S: if s == "G": EG += 1 elif s == "C": EC += 1 else: EP += 1 ans = 0 ans += 3 * min(G, EC) if G >= EC: G -= EC EC = 0 else: EC -= G G = 0 ans += 3 * min(C, EP) if C >= EP: C -= EP EP = 0 else: EP -= C C = 0 ans += 3 * min(P, EG) if P >= EG: P -= EG EG = 0 else: EG -= P P = 0 ans += min(G, EG) ans += min(C, EC) ans += min(P, EP) print(ans)