結果

問題 No.2386 Udon Coupon (Easy)
ユーザー lam6er
提出日時 2025-03-31 17:24:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 61,312 KB
最終ジャッジ日時 2025-03-31 17:25:19
合計ジャッジ時間 3,398 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

max_total = 0

max_x = n // 10
for x in range(max_x + 1):
    m = n - 10 * x
    if m < 0:
        continue
    max_y = m // 5
    start_y = max(0, max_y - 4)
    current_max = 0
    for y in range(start_y, max_y + 1):
        remaining = m - 5 * y
        if remaining < 0:
            continue
        k = remaining // 3
        current = b * y + a * k
        if current > current_max:
            current_max = current
    total = c * x + current_max
    if total > max_total:
        max_total = total

print(max_total)
0