oopp 2009-09-19 00:32:00
点我顶贴
收藏
删除
var a,b,d,f:array[0..5000] of longint;
i,j,n,x,s:longint;
begin
read(n);
for i:=1 to n do begin
read(a[i]);b[i]:=1;end;
for i:=n-1 downto 1 do begin x:=0;
for j:=i+1 to n do if (x<b[j])and(a[i]>a[j]) then
x:=b[j];
b[i]:=b[i]+x;
for j:=i+1 to n do if (b[j]=x)and(a[i]>a[j]) then
d[i]:=d[i]+d[j];if d[i]=0 then d[i]:=1;
end;
x:=0;
for i:=1 to n do if x<b[i] then x:=b[i];
for i:=1 to n do if x=b[i] then s:=s+d[i];
write(x,’ ’,s);
end.
只过了4个点~