結果
| 問題 |
No.2386 Udon Coupon (Easy)
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:59:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 506 bytes |
| コンパイル時間 | 529 ms |
| コンパイル使用メモリ | 82,144 KB |
| 実行使用メモリ | 61,896 KB |
| 最終ジャッジ日時 | 2025-04-15 22:00:37 |
| 合計ジャッジ時間 | 3,962 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
n = int(input())
a, b, c = map(int, input().split())
max_m = n
dp = [0] * (max_m + 1)
for m in range(1, max_m + 1):
option1 = dp[m - 5] + b if m >= 5 else 0
option2 = dp[m - 3] + a if m >= 3 else 0
dp[m] = max(option1, option2)
max_discount = 0
max_z = n // 10
for z in range(max_z + 1):
remaining = n - 10 * z
if remaining < 0:
continue
current_total = z * c + dp[remaining]
if current_total > max_discount:
max_discount = current_total
print(max_discount)
lam6er