摘要:
题中先用并查集判定是否所有点都有联系,即能够拼成一个连通的无向图。 再判定入度为零的点是否为1即可。代码如下:#include <stdio.h>#include <string.h>char name[2010][50];int cnt, N, dg[2010], hash[2010], set[2010];int find( char *n ){ int i; for( i= 0; i< cnt; ++i ) { if( strcmp( n, name[i] )== 0 ) { return i; } } strcpy( name[cnt], n ); ret 阅读全文
posted @ 2011-07-17 10:18
沐阳
阅读(255)
评论(0)
推荐(0)