比赛 暑假培训七 评测结果 AEAWWA
题目名称 过河卒 最终得分 30
用户昵称 打不死的羊 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-07-24 16:00:23
显示代码纯文本
program pj024;
type
fxz=array[0..22,0..22]of longint;
var
i,j,n,m,x,y:longint;
board:fxz;
f1,f2:text;
begin
assign(f1,'pj024.in');
assign(f2,'pj024.out');
reset(f1);rewrite(f2);
readln(f1,n,m,x,y);
for i:=0 to n do
 for j:=0 to m do
 board[n,m]:=0;
board[x,y]:=-1;
if (x-2>=0)and(y-1>=0)then board[x-2,y-1]:=-1;
if (x-2>=0)and(y+1<=m)then board[x-2,y+1]:=-1;
if (x-1>=0)and(y-2>=0)then board[x-1,y-2]:=-1;
if (x-1>=0)and(y+2<=n)then board[x-1,y+2]:=-1;
if (x+2<=n)and(y-1>=0)then board[x+2,y-1]:=-1;
if (x+2<=n)and(y+1<=n)then board[x+2,y+1]:=-1;
if (x+1<=n)and(y-2>=0)then board[x+1,y-2]:=-1;
if (x+1<=n)and(y+2<=n)then board[x+1,y+2]:=-1;
board[0,0]:=1;
if board[n,m]<>-1 then begin
for i:=0 to n do
for j:=0 to m do
  if board[i,j]>0 then begin if board[i+1,j]<>-1 then
                             board[i+1,j]:=board[i+1,j]+board[i,j];
                             if board[i,j+1]<>-1 then
                             board[i,j+1]:=board[i,j+1]+board[i,j];
                       end;
writeln(f2,board[n,m]);
                       end
                  else writeln(f2,'0');
close(f1);close(f2);
end.