level 10
syuku33
楼主
var
a,b:array[0..10000] of longint;
n,i,j,max:longint;
begin
fillchar(b,sizeof(b),0);
read(n);
for i:=1 to n do read(a[i]);
for i:=1 to n do b[i]:=1;
for i:=2 to n do
for j:=1 to i-1 do
if (a[i]<=a[j]) and (b[j]+1>b[i]) then b[i]:=b[j]+1;
max:=0;
for i:=1 to n do if b[i]>max then max:=b[i];
write(max,' ');
for i:=2 to n do
for j:=1 to i-1 do
if (a[i]>a[j]) and (b[j]+1>b[i]) then b[i]:=b[j]+1;
max:=0;
for i:=1 to n do if b[i]>max then max:=b[i];
writeln(max);
end.
2015年04月25日 07点04分
1
a,b:array[0..10000] of longint;
n,i,j,max:longint;
begin
fillchar(b,sizeof(b),0);
read(n);
for i:=1 to n do read(a[i]);
for i:=1 to n do b[i]:=1;
for i:=2 to n do
for j:=1 to i-1 do
if (a[i]<=a[j]) and (b[j]+1>b[i]) then b[i]:=b[j]+1;
max:=0;
for i:=1 to n do if b[i]>max then max:=b[i];
write(max,' ');
for i:=2 to n do
for j:=1 to i-1 do
if (a[i]>a[j]) and (b[j]+1>b[i]) then b[i]:=b[j]+1;
max:=0;
for i:=1 to n do if b[i]>max then max:=b[i];
writeln(max);
end.