记录编号 |
1712 |
评测结果 |
AAAWWA |
题目名称 |
[NOIP 2002]过河卒 |
最终得分 |
40 |
用户昵称 |
zpl123 |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
10.000 s |
提交时间 |
2008-09-07 10:24:40 |
内存使用 |
0.00 MiB |
显示代码纯文本
program chf;
var
x,y,n,m:longint;
a:array[-50..50,-50..50] of longint;
procedure init;
begin
assign(input,'pj024.in');
reset(input);
assign(output,'pj024.out');
rewrite(output);
read(n,m,x,y);
close(input);
a[x,y]:=-1;
a[x-1,y-2]:=-1;
a[x-2,y-1]:=-1;
a[x+1,y-2]:=-1;
a[x+2,y-1]:=-1;
a[x-1,y+2]:=-1;
a[x-2,y+1]:=-1;
a[x+1,y+2]:=-1;
a[x+2,y+1]:=-1;
end;{init}
procedure main;
var
i,j:longint;
begin
for i:=1 to n do if a[i,0]<>-1 then a[i,0]:=1 else break;
for i:=1 to m do if a[0,i]<>-1 then a[0,i]:=1 else break;
for i:=1 to n do
for j:=1 to m do
if a[i,j]<>-1 then
begin
if (a[i-1,j]<>-1)and(a[i,j-1]<>-1) then a[i,j]:=a[i-1,j]+a[i,j-1];
if (a[i-1,j]=-1)and(a[i,j-1]<>-1) then a[i,j]:=a[i,j-1];
if (a[i-1,j]<>-1)and(a[i,j-1]=-1) then a[i,j]:=a[i-1,j];
if (a[i-1,j]=-1)and(a[i,j-1]=-1) then a[i,j]:=0;
end;{then}
end;{main}
procedure print;
begin
writeln(a[n,m]);
close(output);
end;{print}
begin
init;
main;
print;
end.