晕死,上面的程序搞错了,以下面这个为准
#defineDIM10
typedefstruct
{
intx;
inty;
}Position;
intcountstep=0;
intdirection[8][2]={{1,-2},{2,-1},{2,1},{1,2},{-1,2},{-2,1},{-2,-1},{-1,-2}};//马可能前进的8个方向
intm,n;
//递归方法,类似八皇后问题
intChevalierSearch3(Positionpos)
{
countstep++;//对于当前点设置访问几号,其中mark[][]标示该节点是第几个被访问的点
mark[pos.x][pos.y]=countstep;
if(countstep==64)
{
printf("\nwefindasolution\n");
for(inti=1;i=1&&m=1&&n#include
usingnamespacestd;
#defineDIM10
typedefstruct
{
intx;
inty;
}Position;
intmark[DIM][DIM];
intcountstep=0;
boolfound=false;
intdirection[8][2]={{1,-2},{2,-1},{2,1},{1,2},{-1,2},{-2,1},{-2,-1},{-1,-2}};//马可能前进的8个方向
intm,n;
//递归方法,类似八皇后问题
intChevalierSearch3(Positionpos)
{
countstep++;//对于当前点设置访问几号,其中mark[][]标示该节点是第几个被访问的点
mark[pos.x][pos.y]=countstep;
if(countstep==64)
{
found=true;
printf("\nwefindasolution\n");
for(inti=1;i=1&&m=1&&n
|