結果

問題 No.2386 Udon Coupon (Easy)
ユーザー lam6er
提出日時 2025-04-15 22:07:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 81,896 KB
実行使用メモリ 62,384 KB
最終ジャッジ日時 2025-04-15 22:08:51
合計ジャッジ時間 2,884 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a, b, c = map(int, input().split())

max_discount = 0
max_c10 = n // 10

for c10 in range(max_c10 + 1):
    remaining = n - 10 * c10
    if remaining < 0:
        continue
    current_c = c10 * c
    y_max = remaining // 5
    best_5_3 = 0
    # Check y in [y_max-4, y_max]
    start_y = max(0, y_max - 4)
    for y in range(start_y, y_max + 1):
        rem_after_5 = remaining - 5 * y
        if rem_after_5 < 0:
            continue
        x = rem_after_5 // 3
        total = b * y + a * x
        if total > best_5_3:
            best_5_3 = total
    total_d = current_c + best_5_3
    if total_d > max_discount:
        max_discount = total_d

print(max_discount)
0