这里输入20 20 3 3为什么会运行失败?

#include <bits/stdc++.h> using namespace std; int mmp[100][100]; int vis[100][100]; int step = 0; int a, b, n, m; int next1[9][2] = { 0, 0, -2, 1, 2, 1, -2, -1, 2, -1, 1, 2, 1, -2, -1, -2, -1, 2 }; void dfs(int x, int y) { int i; int next[2][2] = { { 0, 1 }, { 1, 0 } }; int tx, ty; if (x == n && y == m) step++; for (i = 0; i < 2; i++) { tx = x + next[i][1]; ty = y + next[i][0]; if (tx < 0 || tx > n || ty < 0 || ty > m) continue; if (!vis[tx][ty] && mmp[tx][ty]) { vis[tx][ty] = 1; dfs(tx, ty); vis[tx][ty] = 0; } } } int main() { int i; cin >> n >> m >> a >> b; memset(vis, 0, sizeof(vis)); memset(mmp, 1, sizeof(mmp)); for (i = 0; i <= 8; i++) if (a + next1[i][0] >= 0 && a + next1[i][0] <= n && b + next1[i][1] >= 0 && b + next1[i][1] <= m) mmp[a + next1[i][0]][b + next1[i][1]] = 0; vis[0][0] = 1; dfs(0, 0); cout << step << endl; return 0; }

dfs函数中,for循环里套for循环,dfs还是个递归函数,没有退出递归的条件,是一个死循环。