Question: give you a high-L-long R-wide c image. Every coordinate can be regarded as a square. You can go up, down, left, right, and front once, move a square in either direction, but cannot move it to a square marked.
Q: Can I start from S to E? If yes, please output the minimum number of moves.
Policy: simple deep search.
Note: because it is the minimum number of moves, you must select the minimum number from all that can be reached.
Code:
# include # include # include # include using namespace STD; # define INF 0x3f3f3fchar map [35] [35] [35]; int ans, L, R, C; const int dirx [6] = {1,-1, 0, 0, 0, 0}; const int diry [6] = {0, 0, 1,-1, 0, 0}; const int dirz [6] = {0, 0, 0, 0, 1,-1}; struct node {int x, y, z; int step ;}; node St, en; queue q; char s [10000]; bool vis [35] [35] [35]; int limit (node s) {return (S. x = 0 & S. y> = 0 & S. Y = 0 & S. z
Nyoj 353 3D dungeon [BFS]