搜索小专题
很水很水的一道搜索题
分别用dfs和bfs写
bfs
其实更容易理解一点
push旧节点拓展出来的新节点,pop旧节点,直到队列为空。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N =110;
int a[N][N];
bool m[N][N];
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
queue<pair<int, int&g
原创
2021-11-08 20:22:40 ·
61 阅读 ·
0 评论