标签:
#include<stdio.h>
int a[100][100]={0},t=0,m,n;
int A(int x,int y)//自定义函数
{
a[x][y]=1;
if(x==m-1&&y==n-1)
t++;
else
{
if(a[x+1][y]==0&&x+1<m)A(x+1,y);
if(a[x][y+1]==0&&y+1<n)A(x,y+1);
if(a[x+2][y]==0&&x+2<m)A(x+2,y);
if(a[x][y+2]==0&&y+2<n)A(x,y+2);//四种走法
}
a[x][y]=0;//都试完的情况下(需要绕道),将那一点记为0
}
int main()
{
freopen("rabbit.in","r",stdin);
freopen("rabbit.out","w",stdout);
scanf("%d%d",&m,&n);
A(0,0);//函数调用
printf("%d",t);//打印
return 0;
}
标签:
原文地址:http://www.cnblogs.com/A922/p/5813739.html