結果
問題 |
No.2386 Udon Coupon (Easy)
|
ユーザー |
![]() |
提出日時 | 2025-04-16 15:38:02 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 789 bytes |
コンパイル時間 | 369 ms |
コンパイル使用メモリ | 82,276 KB |
実行使用メモリ | 75,996 KB |
最終ジャッジ日時 | 2025-04-16 15:43:44 |
合計ジャッジ時間 | 3,411 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
n = int(input()) a, b, c = map(int, input().split()) max_total = 0 max_z = n // 10 for z in range(0, max_z + 1): r = n - 10 * z if r < 0: continue max_y = r // 5 y_candidates = set() # Add lower candidates (0-4) for y in range(0, 5): if y <= max_y: y_candidates.add(y) # Add upper candidates (max_y-4 to max_y) start = max(0, max_y - 4) for y in range(start, max_y + 1): y_candidates.add(y) best = 0 for y in y_candidates: remaining = r - 5 * y if remaining < 0: continue x = remaining // 3 current = b * y + a * x if current > best: best = current total = c * z + best if total > max_total: max_total = total print(max_total)