Hlog 2011-08-10 02:12:00
点我顶贴
收藏
删除
program chess;
var f:array[0..25,0..25] of longint;
i,j,n,m,x,y:integer;
function ok(a,b:integer):boolean;
begin
ok:=true;
if (a=x) and (b=y) then begin ok:=false; exit; end;
if (a-x)*(a-x)+(b-y)*(b-y)=5 then begin ok:=false; exit; end; {距离公式}
end;
begin
readln(n,m,x,y);
f[0][0]:=1;
for i:=0 to n do
for j:=0 to m do
if ok(i,j) then
begin
if i-1>=0 then inc(f[i][j],f[i-1][j]);
if j-1>=0 then inc(f[i][j],f[i][j-1]);
end;
writeln(f[n][m]);
readln;
end.