
图
Silent-Jy
生活是坚持出来的。
展开
-
HDU-1232:畅通工程
/*并查集,将有道路的两个城市并起来,最后输出连通分量数减一*/#include#include#define N 1005using namespace std;typedef struct{ int rank,parent;}UFS;UFS t[N];void MakeSet(int n){ int i; for(i=1;i<=n;i++) { t[i].par原创 2013-01-18 20:05:40 · 523 阅读 · 0 评论 -
HDU-1272:小希的迷宫
/*代码非常乱- -!,这道题要注意使用了哪些数字作为城市的编号, 如1 3 2 3 5 5 0 0这组数据,4没有使用到,连通数为2,不符合条件*/#include#include#include#define N 100005using namespace std;typedef struct{ int rank,parent;}UFS;UFS t[N];int原创 2013-01-18 21:07:08 · 830 阅读 · 0 评论