过河卒问题求修改这是我的程序var a:array[0..20,0..20] of boolean;d:array[0..20,0..20] of longint;i,j,x,y,m,n:longint;beginreadln(n,m,x,y);for i:=0 to n dofor j:=0 to m doa[i,j]:=true;a[x+2,y+1]:=false;a[x+2,y-1]:=false;a[x-2,y+1]:=false;
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 00:13:20
过河卒问题求修改这是我的程序var a:array[0..20,0..20] of boolean;d:array[0..20,0..20] of longint;i,j,x,y,m,n:longint;beginreadln(n,m,x,y);for i:=0 to n dofor j:=0 to m doa[i,j]:=true;a[x+2,y+1]:=false;a[x+2,y-1]:=false;a[x-2,y+1]:=false;
过河卒问题求修改
这是我的程序
var a:array[0..20,0..20] of boolean;
d:array[0..20,0..20] of longint;
i,j,x,y,m,n:longint;
begin
readln(n,m,x,y);
for i:=0 to n do
for j:=0 to m do
a[i,j]:=true;
a[x+2,y+1]:=false;
a[x+2,y-1]:=false;
a[x-2,y+1]:=false;
a[x-2,y-1]:=false;
a[x+1,y+2]:=false;
a[x+1,y-2]:=false;
a[x-1,y+2]:=false;
a[x-1,y-2]:=false;
a[x,y]:=false;
d[0,0]:=1;
for i:=1 to n do if a[i,0]=true then
d[i,0]:=1 else break;
for i:=1 to m do if a[0,i]=true then
d[0,i]:=1 else break;
for i:=1 to n do
for j:=1 to m do
if a[i,j]=true then
d[i,j]:=d[i-1,j]+d[i,j-1];
writeln(d[n,m]);
end.
不知道哪里出错,输出是0,.个人认为没问题⊙﹏⊙b
过河卒问题求修改这是我的程序var a:array[0..20,0..20] of boolean;d:array[0..20,0..20] of longint;i,j,x,y,m,n:longint;beginreadln(n,m,x,y);for i:=0 to n dofor j:=0 to m doa[i,j]:=true;a[x+2,y+1]:=false;a[x+2,y-1]:=false;a[x-2,y+1]:=false;
- -没错,AC代码