记录编号 |
6763 |
评测结果 |
AAAWWA |
题目名称 |
[NOIP 2002]过河卒 |
最终得分 |
66 |
用户昵称 |
name:弓虽 |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
0.026 s |
提交时间 |
2008-11-04 15:05:11 |
内存使用 |
0.12 MiB |
显示代码纯文本
program pj024(input,output);
var
i,j,k:longint;
a:array [-2..20,-2..20] of int64;
n,m,x,y:int64;
begin
assign(input,'pj024.in');
assign(output,'pj024.out');
reset(input);
rewrite(output);
read(n);
read(m);
read(x);
read(y);
a[0,0]:=1;
a[x,y]:=-1;
a[x-1,y-2]:=-1;
a[x-1,y+2]:=-1;
a[x-2,y+1]:=-1;
a[x-2,y-1]:=-1;
a[x+1,y-2]:=-1;
a[x+1,y+2]:=-1;
a[x+2,y+1]:=-1;
a[x+2,y-1]:=-1;
while i<=m do begin
if a[0,i]<>-1 then begin a[0,i]:=1;
i:=i+1;
end
else
begin
for j:=i to m do a[0,j]:=0;
i:=m+1;
end;
end;
k:=0;
while k<=n do begin
if a[k,0]<>-1
then begin
a[k,0]:=1;
k:=k+1;
end
else
begin
for j:=k to n do a[j,0]:=0;
k:=n+1;
end;
end;
for i:=1 to n do
for j:=1 to m do
if (a[i,j]<>-1) then
a[i,j]:=a[i-1,j]+a[i,j-1]
else a[i,j]:=0;
writeln(a[n,m]);
close(input);
close(output);
end.