一二三四五 上山打老虎

随笔分类 -  bfs

搜索
摘要:链接:https://www.acwing.com/problem/content/1115/ 代码: bfs: #include<iostream> #include<algorithm> #include<queue> using namespace std; char s[25][25]; i 阅读全文
posted @ 2021-04-15 10:49 abestxun 阅读(57) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.acwing.com/problem/content/1098/ 思路:1:三维bfs:可以分为当前层数内的二维内偏移和层数的一维偏移 代码: #include<iostream> #include<queue> #include<string> #include<cs 阅读全文
posted @ 2021-04-15 10:42 abestxun 阅读(48) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.acwing.com/problem/content/1235/ 代码: #include<bits/stdc++.h> using namespace std; int k=0,n; char s[1005][1005]; int b[1005][1005]; int 阅读全文
posted @ 2021-04-15 10:38 abestxun 阅读(73) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805392092020736 题意:计算一个图中距离某个点k层以内的点的个数 思路:BFS计算层数 层数只能由上一层得到:next.layer=last.layer 阅读全文
posted @ 2021-03-01 21:18 abestxun 阅读(36) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示