摘要:
好久没写题了,水一水练习一下吧:hdu1272判断连通无环图: 判断成环的时候,只要判断输入边的两个点。 有一个共同的父节点,那么这两个点就成环。 判断连通的时候,只要判断根节点数为1即可。View Code 1 #include <stdio.h> 2 #define N 100010 3 int father[N]; 4 int mark[N]; 5 int find(int x){ 6 if(x!=father[x]) 7 father[x]=find(father[x]); 8 return father[x]; 9 }10 void merge... 阅读全文
posted @ 2013-01-08 14:53
_sunshine
阅读(824)
评论(0)
推荐(0)

浙公网安备 33010602011771号