状态: Accepted
测评机: Xeost[5]
得分: 100分 [我要评价一下题目~]
提交日期: 2012-7-7 10:30:00
有效耗时: 1640毫秒
测试结果1: 通过本测试点|有效耗时171ms
测试结果2: 通过本测试点|有效耗时157ms
测试结果3: 通过本测试点|有效耗时156ms
测试结果4: 通过本测试点|有效耗时156ms
测试结果5: 通过本测试点|有效耗时156ms
测试结果6: 通过本测试点|有效耗时172ms
测试结果7: 通过本测试点|有效耗时172ms
测试结果8: 通过本测试点|有效耗时172ms
测试结果9: 通过本测试点|有效耗时156ms
测试结果10: 通过本测试点|有效耗时172ms
提交代码: view sourceprint?
const
no=false;
yes=true;
dx:array[1..8]of -2..2=(1,2,2,1,-1,-2,-2,-1);
dy:array[1..8]of -2..2=(-2,-1,1,2,2,1,-1,-2);
var
n,m,x,y:longint;
f:array[0..21,0..21]of int64;
g:array[0..21,0..21]of boolean;
procedure init;
var xx,yy,i:longint;
begin
readln(n,m,x,y);
fillchar(f,sizeof(f),0);
fillchar(g,sizeof(g),true);
g[y,x]:=no;
for i:=1 to 8 do
begin
xx:=x+dx[i];
yy:=y+dy[i];
if (xx>=0)and(xx<=n)and(yy>=0)and(yy<=m) then
g[yy,xx]:=no;
end;
end;
procedure work;
var i,j:longint;
begin
f[0,0]:=1;
for i:=1 to m do
if g[i,0] then f[i,0]:=f[i-1,0];
for j:=1 to n do
if g[0,j] then f[0,j]:=f[0,j-1];
for i:=1 to m do
for j:=1 to n do
if g[i,j] then f[i,j]:=f[i-1,j]+f[i,j-1];
end;
procedure ouit;
begin
writeln(f[m,n]);
end;
begin
init;
work;
ouit;
end.