結果
問題 | No.617 Nafmo、買い出しに行く |
ユーザー | autumn_314 |
提出日時 | 2018-08-14 11:03:20 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 29,552 KB |
実行使用メモリ | 159,060 KB |
最終ジャッジ日時 | 2023-10-24 17:02:40 |
合計ジャッジ時間 | 3,416 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 110 ms
158,804 KB |
testcase_07 | WA | - |
testcase_08 | AC | 10 ms
10,620 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 202 ms
159,060 KB |
testcase_16 | WA | - |
testcase_17 | AC | 182 ms
158,152 KB |
testcase_18 | AC | 5 ms
9,712 KB |
testcase_19 | AC | 10 ms
10,620 KB |
testcase_20 | WA | - |
testcase_21 | AC | 39 ms
34,060 KB |
ソースコード
#include <stdio.h> int main(void){ int n,k,w,max=0; int wei[100005]; scanf("%d%d",&n,&k); for(int i=0; i<n; i++){ scanf("%d",&wei[i]); } int dp[25][2000005]; for(int i=0; i<n; i++){ for(int j=0; j<2000005; j++){ if(n==0||k==0)dp[i][j]=0; else if(j+wei[i]>k)dp[i+1][j]=dp[i][j]; else dp[i+1][j+wei[i]]=dp[i][j]+wei[i]; if(max<j+wei[i]&&dp[i+1][j+wei[i]])max=j+wei[i]; } } printf("%d",max); return 0; }