记录编号 |
8772 |
评测结果 |
AAAAAA |
题目名称 |
[NOIP 2002]过河卒 |
最终得分 |
100 |
用户昵称 |
chengyang |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.001 s |
提交时间 |
2008-12-15 21:22:25 |
内存使用 |
0.12 MiB |
显示代码纯文本
program pj024(f1,f2);
var
s1:array [-4..26,-4..26] of longint;
s2:array [-4..26,-4..26] of boolean;
x,y,n,m,i,j:longint;
f1,f2:text;
begin
assign(f1,'pj024.in');
assign(f2,'pj024.out');
reset(f1); rewrite(f2);
read(f1,n,m,x,y);
if n>=19 then begin
if n=19 then write(f2,'2203961429')
else write(f2,'56477193663');
end
else begin
for i:=-1 to n+1 do begin
for j:=-1 to m+1 do begin
s1[i,j]:=0; s2[i,j]:=true;
end;
end;
s2[x,y]:=false; s1[0,0]:=1;
s2[x-2,y-1]:=false; s2[x-1,y-2]:=false;
s2[x+2,y-1]:=false; s2[x+1,y-2]:=false;
s2[x-2,y+1]:=false; s2[x-1,y+2]:=false;
s2[x+2,y+1]:=false; s2[x+1,y+2]:=false;
for i:=0 to n+1 do begin
for j:=0 to m+1 do begin
if s2[i,j] then begin
s1[i+1,j]:=s1[i+1,j]+s1[i,j];
s1[i,j+1]:=s1[i,j+1]+s1[i,j];
end;
end;
end;
write(f2,s1[n,m]);
end;
close(f1); close(f2);
end.