数据结构体
struct node
{
int x,y;
int step;
};
安全函数
bool safe(node st)
{
if(st.x >= 0 && st.y >= 0 && !vis[st.x][st.y] && map[st.x][st.y] != '#')
return true;
return false;
}
bfs实现
void bfs(node st)
{
queue<node>q;
q.push(st);
vis[st.x][st.y] = 1;
node now