88分 哪戳了

P1216 [USACO1.5] [IOI1994]数字三角形 Number Triangles

asd6666 @ 2017-07-09 16:08:07

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 XeCtera @ 2017-07-14 16:24:55

write(a[l,i,1],'-->');

'-->'?


|