#include "iostream"
using namespace std;
int sum1;
int next1[4][2] = { {0,1},{0,-1},{1,0},{-1,0} }; //移动步数
int bookmap1[15][15] = { 0 };
int map1[10][7] = { //地图1
{ 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 0, 0, 0, 0, 0},
{ 1, 0, 0, 0, 0, 0, 0},
{ 1, 0, 0, 0, 0, 0, 0},
{ 1, 0, 0, 0, 2, 0, 0},
{ 1, 0, 0, 0, 0, 0, 0},
{ 1, 0, 0, 0, 0, 0, 0},
{ 1, 0, 0, 0, 0, 0, 0},
{ 1, 0, 0, 0, 0, 0, 0},
{ 1, 1, 1, 1, 1, 0, 3}
};
void dfs(int x, int y) {
int tx, ty;
if (x == 9 && y == 6) {
sum1++;
return;
}
for (int i = 0; i <= 3; i++) {
tx = x + next1[i][0];
ty = y + next1[i][1];
if (tx < 0 || ty < 0 || tx>9 || ty>6 || map1[tx][ty] == 1)
continue;
if ((map1[tx][ty] == 0 ||map1[tx][ty]==3) && bookmap1[tx][ty] == 0)
{
bookmap1[tx][ty] = 1;
dfs(tx, ty);
bookmap1[tx][ty] = 0;
}
}
}
int main() {
bookmap1[4][4] = 1;
dfs(4, 4);
cout<<sum1;
}
输出不了