acm(BFS)
timu
不会编程怎么行
fighting
展开
-
数据结构实验之图论五:从起始点到目标点的最短步数(BFS)
#include <bits/stdc++.h> using namespace std; int a[1111][1111]; int book[1111]; int step[1111]; void bfs(int st) { step[st]=0; if(st==1)return; queue<int>q; book[st]=1;...原创 2020-05-06 10:40:34 · 71 阅读 · 0 评论 -
广度优先搜索(BFS)
#include <bits/stdc++.h> using namespace std; int a[111][111]; vector<int>ans; queue<int>q; int book[111]; void bfs(int n) { while(!q.empty()) { int t=q.front(); ...原创 2020-05-06 10:40:12 · 109 阅读 · 0 评论 -
找朋友(bfs)
#include <bits/stdc++.h> using namespace std; int n,m; char e[100][100]; int book[110][110]; int next[4][2]= {{0,1},{1,0},{0,-1},{-1,0}}; struct node { int x,y; int s; }; int main() { ...原创 2020-05-04 20:23:38 · 317 阅读 · 0 评论