foo.cc:4:17: error: expected ']' before ';' token
#define len 1010;
^
foo.cc:5:7: note: in expansion of macro 'len'
int f[len],v[len],w[len];
^~~
foo.cc:5:10: error: expected unqualified-id before ']' token
int f[len],v[len],w[len];
^
foo.cc:5:17: error: expected unqualified-id before ']' token
int f[len],v[len],w[len];
^
foo.cc:5:24: error: expected unqualified-id before ']' token
int f[len],v[len],w[len];
^
foo.cc: In function 'int main()':
foo.cc:8:19: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'int' [-Wformat=]
scanf("%d%d",&W,n);
^
foo.cc:10:17: error: 'w' was not declared in this scope
scanf("%d%d",&w[i],&v[i]);
^
foo.cc:10:23: error: 'v' was not declared in this scope
scanf("%d%d",&w[i],&v[i]);
^
foo.cc:12:22: error: 'w' was not declared in this scope
for(int l = W;l >= w[i];l--)
^
foo.cc:13:4: error: 'f' was not declared in this scope
f[l]=max(f[l],f[l-w[i]]+v[i]);
^
foo.cc:13:28: error: 'v' was not declared in this scope
f[l]=max(f[l],f[l-w[i]]+v[i]);
^
foo.cc:13:32: error: 'max' was not declared in this scope
f[l]=max(f[l],f[l-w[i]]+v[i]);
^
foo.cc:13:32: note: suggested alternative:
In file included from /usr/include/c++/6/algorithm:62:0,
from foo.cc:3:
/usr/include/c++/6/bits/stl_algo.h:3465:5: note: 'std::max'
max(initializer_list<_Tp> __l, _Compare __comp)
^~~
foo.cc:14:14: error: 'f' was not declared in this scope
printf("%d",f[W]);
^
自豪的采用jd5进行评测(github.com/masnn/jd5)