lishuhanji 2013-08-29 21:18:00
点我顶贴
收藏
删除
有效耗时: 2844毫秒
测试结果1: 通过本测试点|有效耗时203ms
测试结果2: 通过本测试点|有效耗时313ms
测试结果3: 通过本测试点|有效耗时484ms
测试结果4: 通过本测试点|有效耗时172ms
测试结果5: 通过本测试点|有效耗时172ms
测试结果6: 通过本测试点|有效耗时313ms
测试结果7: 通过本测试点|有效耗时453ms
测试结果8: 通过本测试点|有效耗时218ms
测试结果9: 通过本测试点|有效耗时282ms
测试结果10: 通过本测试点|有效耗时234ms
var
a,f:array[0..100000]of longint;
i,j,k,n:longint;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=n downto 1 do
begin
if a[i]=0 then continue
else f[i]:=1;
for j:=i+1 to n do
if (a[i]<a[j])and(f[j]+1>f[i])then
f[i]:=1+f[j];
end;
for i:=1 to n do
if f[i]>k then k:=f[i];
writeln(k);
end.
(Ctrl+c)+(Ctrl+v)或复制粘贴