| 比赛 | 20120712 | 评测结果 | AAAAAAAAAA |
|---|---|---|---|
| 题目名称 | 爆炸化合物 | 最终得分 | 100 |
| 用户昵称 | xbwcan | 运行时间 | 0.118 s |
| 代码语言 | C++ | 内存使用 | 0.67 MiB |
| 提交时间 | 2016-02-17 10:50:43 | ||
#include<cstdio>
int f[100005];
int find(int x){return f[x]?f[x]=find(f[x]):x;};
int main(){
freopen("explosion.in","r",stdin);
freopen("explosion.out","w",stdout);
int x,y,ans=0;
while(scanf("%d%d",&x,&y)==2){
x++,y++;
x=find(x),y=find(y);
if(x!=y)f[x]=y;
else ans++;
}
printf("%d",ans);
return 0;
}