| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这个就对了,其他的一样In Reply To:c/c++不是excel,uset[]的内容不会自动变的 Posted by:frkstyc at 2005-08-04 17:34:00
while(scanf("%d%d",&n,&m) && n+m)
{
for(i=0; i<=n; i++)
uset[i] = i;
ans = n;
for(i=0; i<m; i++)
{
scanf("%d%d",&a,&b);
if(Root(a)!=Root(b))
{
ans--;
uset[uset[b]] = uset[a];
}
}
printf("Case %d: %d\n",ncase,ans);
ncase++;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator