摘要: #include#include#includeusing namespace std;#define maxn 11#define maxm 20struct edge{ int u,v,w;}edges[maxm];int father[maxn];int m,n;void ufset(){ for(int i=0; i=0; s=father[s]); while(s!=x) { int tmp=father[x]; father[x]=s; x=tmp; } return x;}void Union(int ... 阅读全文
posted @ 2013-07-22 23:18 JKXQJ 阅读(242) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1213#include#includeusing namespace std;#define N 1000int father[N];void ufset(){ for(int i=0;i=0;s=father[s]); while(s!=x) { int tmp=father[x]; father[x]=s; x=tmp; } return x;}void Union(int R1,int R2){ int r1=find(R1)... 阅读全文
posted @ 2013-07-22 11:36 JKXQJ 阅读(191) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1702#include#include#include#includeusing namespace std;int main(){ // freopen("1.txt","r",stdin); int n; scanf("%d",&n); while(n--) { int m,i,x; listli; li.clear(); char s[10],ss[10]; scanf("%d %s",&m,s); ... 阅读全文
posted @ 2013-07-22 00:14 JKXQJ 阅读(126) 评论(0) 推荐(0) 编辑