走迷宫
题目描述
现在有一个N*N的地图,问从起点 ( s x , s y ) (sx,sy) (sx,sy)到 ( t x , t y ) (tx,ty) (tx,ty)最少要走几步。
输入格式
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210612193534389.png)
输出格式
仅有一个数,表示答案。
样例输入
5
01111
00111
10001
11101
11100
1 1 5 5
样例输出
8
解题思路
考虑BFS(广度优先搜索)。
可以用dx,xy等常数数组预先保存移动一步坐标的变化情况,简化代码
Code
#include <cstdio>
#include <iostream>
using namespace std;
const int</