結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2023-01-15 14:44:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 764 ms / 5,000 ms |
| コード長 | 254 bytes |
| コンパイル時間 | 727 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 64,768 KB |
| 最終ジャッジ日時 | 2024-12-28 07:02:27 |
| 合計ジャッジ時間 | 7,425 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
l=int(input())
n=int(input())
W=list(map(int,input().split()))
DP=[-1]*(l+1)
DP[0]=0
DP[W[0]]=1
for i in range(1,n):
for j in range(l-W[i],-1,-1):
if DP[j]==-1:
continue
DP[j+W[i]]=max(DP[j+W[i]],DP[j]+1)
print(max(DP))