math与cena之争

【math与cena之争】今天用cena测金陵中学一次竞赛(圣诞赛)……被cena狠狠坑了……
源码:
uses math;
var a:array[1..200] of longint;
f:array[1..200,1..200] of boolean; n,i,big,j,x:longint;
begin
assign(input,'tree.in');
reset(input);
assign(output,'tree.out');
rewrite(output);
read(n);
fillchar(f,sizeof(f),false);
for i:=1 to n do
begin
read(a[i]);
while not eoln do
begin read(x); f[x,i]:=true; end;
big:=0;
for j:=1 to i-1 do
if f[i,j] then big:=max(big,f[i,j]);
a[i]:=a[i]+big;
end;
write(maxvalue(a));
close(input); close(output);
end .
运行时错误……用不了math单元……
改:
var a:array[1..200] of longint;
f:array[1..200,1..200] of boolean; n,i,big,j,x:longint;
begin
assign(input,'tree.in');
reset(input);
assign(output,'tree.out');
rewrite(output);
read(n);
fillchar(f,sizeof(f),false);
for i:=1 to n do
begin
read(a[i]);
while not eoln do
begin read(x); f[x,i]:=true; end;
big:=0;
for j:=1 to i-1 do
if f[i,j] then if a[j]>big then big:=a[j];
a[i]:=a[i]+big;
end;
big:=0;
for i:=1 to n do if a[i]>big then big:=a[i];
close(input); close(output);
end .
AC……TAT
转载于:https://www.cnblogs.com/love-saber/p/5907245.html

    推荐阅读