- 装箱问题
- 2009-05-08 13:29:35 @
数组害人,
开无敌大,
才行!
开到20000才行!!!
2 条评论
-
零浅忧 LV 7 @ 2014-11-02 15:19:19
(⊙o⊙)…坑死,的确是开大数组就对了!
-
2014-08-07 10:33:27@
var
s:array[0..20000]of 0..1;
sv,v,n,i,j:integer;
begin
readln(sv);
readln(n);
s[0]:=1;
for i:=1 to n do begin
readln(v);
for j:=sv-v downto 0 do
if s[j]=1 then s[j+v]:=1;
end;
for i:=sv downto 0 do
if s[i]=1 then begin
writeln(sv-i);
exit;
end;
end
- 1