- 积木城堡
- 2013-10-25 16:28:31 @
var
i,j,k,l,n,m,x:longint;
a,b,c:array[1..1000000] of longint;
f:array[0..1000000] of boolean;
begin
assign(input,'1059.in'); reset(input);
assign(output,'1059.out'); rewrite(output);
readln(n);
for i:=1 to n do
begin
l:=0;
read(x);
f[0]:=true;
while x<>-1 do
begin
for j:=0 to l do begin if f[j]=true then f[j+x]:=true; end;
l:=l+x;
read(x);
end;
for j:=1 to l do if f[j]=true then inc(a[j]);
fillchar(f,sizeof(f),false);
end;
for i:=10000 downto 1 do
if a[i]=n then begin writeln(i); halt; end;
writeln(0);
close(input);
close(output);
end.
哪错了,求帮助
1 条评论
-
singlesos LV 7 @ 2016-01-07 14:26:12
小编改数据了 笑哭
- 1