@[天下的小流氓](/space/show?uid=66902) j-a[i]可能会是负值造成数组越界占用其他空间或者RE掉。
by Victorique @ 2017-12-30 15:29:35
是应该加一个条件限定吗w
by 天下的小流氓 @ 2017-12-30 15:41:09
@[Victorique](/space/show?uid=49223)
by 天下的小流氓 @ 2017-12-30 15:41:24
```cpp
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int f[1001];
int a[100];
int main()
{
int v,n;
scanf("%d",&v);
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
for(int j=v;j>=a[i];j--)
{
f[j]=max(f[j],f[j-a[i]]+a[i]);
}
}
printf("%d",v-f[v]);
return 0;
}
```
by 天下的小流氓 @ 2017-12-30 15:54:37
QAQ修改后最后一个点RE了
by 天下的小流氓 @ 2017-12-30 15:55:06
@[天下的小流氓](/space/show?uid=66902) f数组开小了把,最大体积20000能对那么多点不错了。
by Victorique @ 2017-12-30 15:57:54
已经解决谢谢W
by 天下的小流氓 @ 2017-12-30 16:16:57