首页 > 试题广场 >

const SIZE = 100; var n...

[填空题]
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.

输入:
8
3 2 5 11 12 7 4 10
输出:1

这道题你会答吗?花几分钟告诉大家答案吧!