- 笨笨的导弹攻击
- 2009-07-09 16:28:40 @
50分 为什么??
var f:array[0..10000,1..2] of longint;
a:array[0..10000] of longint;
i,j,max,n:longint;
begin
readln(n);
for i:=1 to n do read(a[i]);
f[0,1]:=0;f[0,2]:=0;
for i:=1 to n do
begin
max:=0;
for j:=1 to i-1 do
if (f[j,2]>max) and (a[j]max) and (a[j]>a[i]) then
max:=f[j,1];
f:=max+1;
end;
if f[n,1]>f[n,2] then writeln(f[n,1]) else writeln(f[n,2]);
end.
6 条评论
-
hzx2008 LV 10 @ 2009-07-11 18:12:59
输出也错了,我对你无语
-
2009-07-10 07:19:10@
明白了~~!! 谢谢
-
2009-07-09 21:24:55@
……50分……
这都能做到……
初始化错了吧…… -
2009-07-09 20:19:11@
ls 说得对,应该让f[1,1]:=1;f[1,2]:=0;再从2到n开始dp
-
2009-07-09 16:47:38@
将max的初值改成-1也不行啊
-
2009-07-09 16:34:02@
f[1,2]显然不能等于1
- 1