![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS
jd1516
这个作者很懒,什么都没留下…
展开
-
pat甲级 1118 Birds in Forest (25 分)
1118 Birds in Forest (25 分)DFS解法#include<iostream>#include<vector>#include<cstring>using namespace std;const int maxn = 10010;struct bird{ int id; int root; //同一颗树上的根结点小鸟} Bird[maxn];int n, k, num = 0, treeNum = 0;vec原创 2021-08-19 21:54:42 · 77 阅读 · 0 评论 -
pat甲 1114 Family Property (25 分) (DFS)
1114 Family Property (25 分)此题一般是用并查集解,在这里提供DFS的解法,供大家参考~#include<iostream>#include<map>#include<vector>#include<cstring>#include<algorithm>using namespace std;const int maxn = 100000; //最大人数应该不超过1000*8struct people原创 2021-08-18 21:42:18 · 83 阅读 · 0 评论