笨-Archangel

导航

2012年4月11日

ACM HDU 1232 交通工程 并查集

摘要: #include<iostream>#include<cstdio>using namespace std;int city[1005];int sum;int find(int x){ int r=x; while(city[r]!=r) { r=city[r]; } return r;}void mege(int x,int y){ int fx,fy; fx=find(x); fy=find(y); if(fx!=fy) { if(fx>fy) city[fx]=fy; ... 阅读全文

posted @ 2012-04-11 16:46 笨-Archangel 阅读(117) 评论(0) 推荐(0)