原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1829代码:#include <stdio.h>#include<memory.h>using namespace std;int father[2001],child[2001],sex[2001];int findfather(int x){ while(x!=father[x]) x=father[x]; return x;}void unitnode(int x,int y){ x=findfather(x); y=findfather(y); if(x==y) re Read More
posted @ 2013-05-27 10:19
supersnow0622
Views(195)
Comments(0)
Diggs(0)
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1232代码:#include<iostream>using namespace std;int father[1001];int findfather(int x){ while(father[x]!=x)//如果x的父节点不是他本身,证明x不是根 x=father[x]; return x;}void unitnode(int x,int y){ int f1=findfather(x); int f2=findfather(y); if(f1!=f2) fathe... Read More
posted @ 2013-05-27 10:17
supersnow0622
Views(191)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号