1739. 迷宫的所有路径-深度优先搜索-DFS

1739. 迷宫的所有路径-深度优先搜索-DFS_第1张图片

代码:

#include
using namespace std;
int n;
int fx[4]={0,1,0,-1};
int fy[4]={1,0,-1,0};
bool vis[100][100];
int q[35][3];
int c;
void print(int k){
	c++;
	cout<";
		}
		
	}
	cout<=1&&tx<=n&&ty>=1&&ty<=n&&vis[tx][ty]==false){
				vis[tx][ty]=true;
				dfs(tx,ty,k+1);	
				vis[tx][ty]=false; 
			}
				
				
		}
		
	}
}
int main(){
	cin>>n;
	vis[1][1]=true;
	
	dfs(1,1,1);
	return 0;
}

你可能感兴趣的:(深度优先,算法)