什么情况?

测试数据 #0: WrongAnswer, time = 0 ms, mem = 10520 KiB, score = 0
测试数据 #1: Accepted, time = 0 ms, mem = 10520 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 10524 KiB, score = 10
测试数据 #3: Accepted, time = 15 ms, mem = 10524 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 10520 KiB, score = 10
测试数据 #5: Accepted, time = 31 ms, mem = 10520 KiB, score = 10
测试数据 #6: Accepted, time = 31 ms, mem = 10524 KiB, score = 10
测试数据 #7: Accepted, time = 125 ms, mem = 10520 KiB, score = 10
测试数据 #8: Accepted, time = 234 ms, mem = 10524 KiB, score = 10
测试数据 #9: Accepted, time = 171 ms, mem = 10520 KiB, score = 10

后面大的数据都过了,竟然第一个错了?! 帮忙看看我的源程序有什么问题
var f:array[1..100,0..100000] of boolean;
a:array[0..100] of longint;
i,j,k,tot,max,t,n:longint;
p:boolean;

begin
readln(n);
for i:=1 to n do
begin
tot:=0;
t:=0;
fillchar(a,sizeof(a),0);
while a[t]>=0 do
begin
inc(t);
read(a[t]);
tot:=tot+a[t];
end;
if tot>max then max:=tot;
dec(t); inc(tot);
f[i,0]:=true;
for j:=1 to t do
for k:=tot downto a[j] do if f[i,k-a[j]] then f[i,k]:=true;
end;
for j:=max downto 1 do
begin
p:=true;
for i:=1 to n do if f[i,j]=false then p:=false;
if p then
begin
writeln(j);
exit;
end;
end;
writeln(0);
end.

1 条评论

  • 1

信息

ID
1059
难度
6
分类
动态规划 | 背包 点击显示
标签
(无)
递交数
7828
已通过
2342
通过率
30%
被复制
19
上传者