level 6
soso9spikear
楼主
program p1004;const m=20;var a,b:array[1..m] of integer; c:array[1..m] of boolean; d,i,j,n,w,max:integer; function ok:boolean; var tt:boolean; begin tt:=true; for i:=1 to w do if c[i] then tt:=false; ok:=tt; end;begin assign(input,'D:/tongji/input.txt');reset(input); i:=0; repeat inc(i); read(a[i]); until seekeof; w:=i; for i:=1 to w do b[i]:=1; for i:=w downto 1 do begin max:=0; for j:=i to w do if (a[j]<=a[i]) and (b[j]>max) then max:=b[j]; b[i]:=b[i]+max; end; max:=0; for i:=1 to w do if b[i]>max then max:=b[i]; write(max,' '); for i:=1 to w do c[i]:=true; d:=0; repeat inc(d); for i:=1 to w do if c[i] then begin c[i]:=false; for j:=i to w do if (a[j]<=a[i]) and (a[j]>max) then max:=a[j]; j:=1; while a[j]<>max do inc(j); i:=j; c[j]:=false end; until ok; writeln(d); close(input);end.
2006年05月21日 09点05分
1