#include #include using namespace std;bool map[102][102];bool visit[101] = {0};int N, M;int sum; int bfs(int start, int end){ queue > q; for(int i=1; i N >> M; for(int i=1; i> a >> b; map[a][b]=1; map[b][a]=1; } int min = 100; int min_index; for(int i=1; i
#include #include using namespace std; bool G[102][102]; int find(int start, int end, int N) { bool visited[102] = { 0 }; queue q; q.push(start); int next; int now = q.front(); while (!q.empty()) { now = q.front(); q.pop(); for (int i = 1; i > N; input_G(N); for (int i = 1; i
#include #include using namespace std; struct cord { int x; int y; }; bool map[102][102]; int visited[102][102]; void input_map(int N, int M) { char c; for (int i = 1; i c; if (c == '1') map[i][j] = 1; else map[i][j] = 0; } } int solv_maze(int n, int m, cord s) { //int cnt = 0; queue q; q.push(s); cord next; cord now = q.front(); visited[now.y][now.x] = 1; while (!q.empty()) { now = q.front(); q..