比赛 |
20120925 |
评测结果 |
AAAAAAAAAA |
题目名称 |
数列游戏 |
最终得分 |
100 |
用户昵称 |
makeecat |
运行时间 |
0.053 s |
代码语言 |
Pascal |
内存使用 |
4.79 MiB |
提交时间 |
2012-09-25 20:46:43 |
显示代码纯文本
Const
ProgramName='seqgame';
Var
i,j,k,n,m,l,r,s,t,x,y,ans:longint;
a:array[0..1100]of longint;
f:array[0..1100,0..1100]of longint;
Procedure Pin;
var
i,j,k:longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
readln;
end;
Procedure Main;
var
i,j,k:longint;
begin
fillchar(f,sizeof(f),0);
ans:=0;
for i:=1 to n do
begin
if a[i]=i then
f[i,0]:=f[i-1,0]+1
else
f[i,0]:=f[i-1,0];
for j:=1 to i-1 do
begin
if a[i]=i-j then
f[i,j]:=f[i-1,j]+1
else
f[i,j]:=f[i-1,j];
if f[i,j]<f [i-1,j-1] then
f[i,j]:=f[i-1,j-1];
if i=n then
if ans<f[i,j] then
ans:=f[i,j];
end;
end;
end;
Procedure Pout;
var
i,j,k:longint;
begin
writeln(ans);
end;
begin
assign(input,ProgramName+'.in');
assign(output,ProgramName+'.out');
reset(input);
rewrite(output);
pin;
main;
pout;
close(input);
close(output);
end.