求数据结构课程设计 马踏棋盘C语言

求数据结构课程设计 马踏棋盘C语言,第1张

调试了一下,发现运行到后来就进入死循环了。
void Run(int a[9][9], int x, int y, int tot){
if(tot >= 64) {
Show(a);
return;
}
tot++;
for(int i = 1; i < 9; ++i){
int nx = x+dy[i][0], ny = y+dy[i][1];
if(!a[nx][ny] && nx > 0 && ny > 0 && nx < 9 && ny < 9){
a[nx][ny] = tot;
Run(a, nx, ny, tot);//这里
}
}
a[x][y] = 0;
tot--;//这里
}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12704638.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-27
下一篇 2023-05-27

发表评论

登录后才能评论

评论列表(0条)

保存