题目: |
const SIZE = 100;
Var n, ans, i, j : integer;
height, num : array[1..SIZE] of integer;
begin
read(n);
for i := 1 to n do
begin
read(height[i]);
num[i] := 1;
for j := 1 to i-1 do
begin
if ((height[j] < height[i]) and
(num[j] >= num[i])) then num[i] := num[j]+1;
end;
end;
ans := 0;
for i := 1 to n do
begin
if (num[i] > ans) then ans := num[i];
end;
writeln(ans);
end.
输入:6
2 5 3 11 12 4 输出:4
|