链接
题目描述
现在有一个 N*N 的地图,问从起点 (sx,sy) 到 (tx,ty) 最少要走几步。
样例输入
5
01111
00111
10001
11101
11100
1 1 5 5
样例输出
8
思路
直接广搜,如果有能到的点就加入队列,满足条件就立刻输出
代码
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LYF using
#define AK namespace
#define IOI std;
LYF AK IOI//%%%
int sx, sy, tx, ty, n;
int dx[4] = {
0, 0, 1, -1};
int dy[4] = {
1, -1, 0, 0};
int a