摘要: 水题。无向图欧拉通路的判定。用并查集判定是不是连通图!#include#include#include#includeusing namespace std;const int maxn = 1000 + 10;int tott[maxn];int father[maxn];int find(int... 阅读全文
posted @ 2015-06-22 10:23 Fighting_Heart 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 最小生成树水题,先按最小生成树做,答案最后加上最小的从第i号楼接线到外界供电设施所需要的费用即可。#include#include#include#includeusing namespace std;const int maxn = 500;struct abc{int uu, vv, cc;}n... 阅读全文
posted @ 2015-06-22 10:01 Fighting_Heart 阅读(347) 评论(0) 推荐(0) 编辑
摘要: DFS水题。题意说明了这是一颗树,那么只要按照根节点DFS下去就好了,DFS的时候记录一下当前在哪个结点,还有父节点是谁,就AC了!#include#include#include#include#includeusing namespace std;const int maxn = 100000 ... 阅读全文
posted @ 2015-06-22 09:42 Fighting_Heart 阅读(145) 评论(0) 推荐(0) 编辑