結果

問題 No.2386 Udon Coupon (Easy)
ユーザー komkompi
提出日時 2023-07-21 22:30:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-09-21 23:58:59
合計ジャッジ時間 4,429 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

N=int(input())

A,B,C=map(int,input().split())

dic={3:A,5:B,10:C}

dp=[-1]*(N+1)

dp[0]=0

for i in range(N):
    if dp[i]!=-1:
        for n,price in dic.items():
            if i+n<=N:
                dp[i+n]=max(dp[i+n],dp[i]+price)

print(max(dp))
0