67.迷宫问题(广搜)
![67.迷宫问题(广搜) 67.迷宫问题(广搜)](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
样例输入1:
5 9
1 1 4 9
0 -1 0 0 0 0 0 0 -1
0 0 0 0 -1 0 0 0 -1
-1 0 0 0 0 0 -1 -1 -1
0 0 -1 -1 0 0 0 0 0
0 0 0 0 0 0 0 -1 -1
样例输出1:
(1,1)->(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(3,5)->(3,6)->(4,6)->(4,7)->(4,8)->(4,9)
样例输入2:
8
2 1
8 4
-1
-1
-1
-1
-1
-1
-1
样例输出2:
(2,1)->(2,2)->(2,3)->(2,4)->(3,4)->(4,4)->(4,3)->(5,3)->(6,3)->(6,4)->(7,4)->(8,4)
样例输入3:
8 5
2 1
8 4
-1
-1
-1
-1
-1
-1
-1
样例输出3:
no way
代码:
一:广搜:
#include
using namespace std;
#include
int n,m,qx,qy,zx,zy;
int jz[101][101];
int pre[101];
int xx[]={0,0,1,-1};
int yy[]={1,-1,0,0};
struct Point{
};
Point point[101];
void input()
{
}
void out(int d)
{
}
void BFS()
{
}
int main()
{
}