結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
![]() |
提出日時 | 2025-03-20 18:52:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 38 ms / 5,000 ms |
コード長 | 624 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 83,008 KB |
実行使用メモリ | 53,628 KB |
最終ジャッジ日時 | 2025-03-20 18:53:00 |
合計ジャッジ時間 | 1,542 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
# Read input G, C, P = map(int, input().split()) S = input().strip() # Count opponent's moves cnt_G = S.count('G') cnt_C = S.count('C') cnt_P = S.count('P') # Calculate maximum wins for each type a = min(cnt_G, P) b = min(cnt_C, G) c = min(cnt_P, C) # Remaining opponent's moves after wins rem_G = cnt_G - a rem_C = cnt_C - b rem_P = cnt_P - c # Remaining moves for yuki yg_rem = G - b yc_rem = C - c yp_rem = P - a # Calculate maximum draws draw_G = min(rem_G, yg_rem) draw_C = min(rem_C, yc_rem) draw_P = min(rem_P, yp_rem) # Total score total_score = 3 * (a + b + c) + (draw_G + draw_C + draw_P) print(total_score)