简单动规,转移的是累计上升的个数
(这题可以详细点,作者因为申请吧主不成功有点郁闷,现在听听歌心情好了,决定多写点题解)
动态转移方程:b[i]:=max{b[j]+1,b[i]} //b[i]是当前指向的元素,b[j]是前面所有元素的循环
算了,太简单,不写了
program gold1576;
var
a:Array[0..5050] of longint;
max,i,j,n:longint;
b:array[1..5050] of integer;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to n do
for j:=0 to i-1 do
begin
if (a[i]>a[j]) and (b[j]+1>b[i]) then b[i]:=b[j]+1;
end;
for i:=1 to n do
if b[i]>max then max:=b[i];
writeln(max);
end.
(这题可以详细点,作者因为申请吧主不成功有点郁闷,现在听听歌心情好了,决定多写点题解)
动态转移方程:b[i]:=max{b[j]+1,b[i]} //b[i]是当前指向的元素,b[j]是前面所有元素的循环
算了,太简单,不写了
program gold1576;
var
a:Array[0..5050] of longint;
max,i,j,n:longint;
b:array[1..5050] of integer;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to n do
for j:=0 to i-1 do
begin
if (a[i]>a[j]) and (b[j]+1>b[i]) then b[i]:=b[j]+1;
end;
for i:=1 to n do
if b[i]>max then max:=b[i];
writeln(max);
end.