asd6666 @ 2017-07-09 16:06:56
var
a:array[1..1000,1..1000,1..3] of integer;
n,i,t,l,k:integer;
begin
readln(n);
for i:=1 to n do
for t:=1 to i do
begin
read(a[i,t,1]);
a[i,t,2]:=a[i,t,1];
a[i,t,3]:=0;
end;
for i:=n-1 downto 1 do
for t:=1 to i do
if (a[i+1,t,2]>a[i+1,t+1,2]) then
begin
a[i,t,2]:=a[i,t,2]+a[i+1,t,2];
a[i,t,3]:=0;
end
else
begin
a[i,t,2]:=a[i,t,2]+a[i+1,t+1,2];
a[i,t,3]:=1;
end;
writeln('max=',a[1,1,2]);
i:=1;
for l:=1 to n-1 do
begin
write(a[l,i,1],'-->');
i:=i+a[l,i,3]
end;
writeln(a[n,i,1]);
end.
by MMMMM222 @ 2017-07-15 09:50:31
友情提示:最后一个点数据很大,数组要开到一亿
by MMMMM222 @ 2017-07-15 09:51:01
@asd6666
by MMMMM222 @ 2017-07-15 09:51:30
@ asd6666