結果
| 問題 |
No.2386 Udon Coupon (Easy)
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 18:49:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 798 bytes |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 82,772 KB |
| 実行使用メモリ | 74,372 KB |
| 最終ジャッジ日時 | 2025-03-20 18:50:53 |
| 合計ジャッジ時間 | 3,641 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 2 |
ソースコード
n = int(input())
a, b, c = map(int, input().split())
max_total = 0
max_z = n // 10
for z in range(max_z + 1):
m = n - 10 * z
if m < 0:
continue
y_max = m // 5
y_opt = (m * 2) % 3 # This gives the y that makes (m - 5y) divisible by 3 (0 mod 3)
candidates = {y_max, y_max - 1, y_max - 2, y_opt, y_opt + 1, y_opt - 1}
valid = []
for y in candidates:
if 0 <= y <= y_max:
valid.append(y)
current_max = 0
for y in valid:
remaining = m - 5 * y
if remaining < 0:
continue
x = remaining // 3
total = b * y + a * x
if total > current_max:
current_max = total
total_z = c * z + current_max
if total_z > max_total:
max_total = total_z
print(max_total)
lam6er