很基础的一道bfs
/*这题是一个三维的迷宫题目,其中用'.'表示空地,'#'表示障碍物,'S'表示起点,'E'表示终点,
求从起点到终点的最小移动次数,解法和二维的类似,
只是在行动时除了东南西北移动外还多了上下。
对于题目给出数据的含义就是输入l,r,c,分别代表迷宫有l层,每层长宽分别是c,r。
对于数据以可以这样移动
(1,1,1)->(1,1,2)->(1,1,3)->(1,1,4)->(1,1,5)->(1,2,5)
->(1,3,5)->(1,3,4)->(1,4,4)->(2,4,4)->(2,4,5)->(3,4,,5)
共11步就可以到达终点
对于数据二明显不能到达,则输出Trapped*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <queue>
#define MAX_SIZE 32
using namespace std;
int l,r,c;
char Map[MAX_SIZE][MAX_SIZE][MAX_SIZE];
bool vis[MAX_SIZE][MAX_SIZE][MAX_SIZE];
int dx[6]={1,0,-1,0,0,0};
int dy[6]={0,1,0,-1,0,0};
int dz[6]={0,0,0,0,-1,1};
struct node{
int x,y,z,step;
};
bool judge(int x,int y,int z)
{
if(x<r&&x>=0 && y<c&&y>=0 && z<l&&