Ice_cream's world I
Ice_cream's world I
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 1 Accepted Submission(s) : 1
#include<stdio.h>
int wall[];
int find(int x){
int r=x;
while(r!=wall[r])r=wall[r];
int i=x,j;
while(i!=r)j=wall[i],wall[i]=r,i=j;
return r;
}
int main(){
int N,M,temp1,temp2,f1,f2,flot;
while(~scanf("%d%d",&N,&M)){
for(int i=;i<N;++i)wall[i]=i;
flot=;
while(M--){
scanf("%d%d",&temp1,&temp2);
f1=find(temp1);f2=find(temp2);
if(f1!=f2)wall[f1]=f2;
else flot++;
}
printf("%d\n",flot);
}
return ;
}
Ice_cream's world I的更多相关文章
- A - Ice_cream’s world III
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Pract ...
- hdu 2120 Ice_cream's world I
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2120 Ice_cream's world I Description ice_cream's worl ...
- HDU 2121 Ice_cream’s world II 不定根最小树形图
题目链接: 题目 Ice_cream's world II Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- hdoj 2120 Ice_cream's world I【求成环数】
Ice_cream's world I Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- hdoj 2122 Ice_cream’s world III
并查集+最小生成树 Ice_cream’s world III Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 ...
- Ice_cream’s world III--2122
Ice_cream’s world III Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- Ice_cream's world I--hdu2120
Ice_cream's world I Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- Ice_cream’s world III(prime)
Ice_cream’s world III Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Othe ...
- hdoj 2121 Ice_cream’s world II 【没有最低树的根节点】
称号:pid=2121" target="_blank">hdoj 2121 Ice_cream's world II 题意:题目是一道躶题,给n个点,m条边的有向 ...
随机推荐
- Node.JS + MongoDB技术浅谈
看到一个Node.JS + MongoDB的小样例,分享给大家.魔乐科技软件学院(www.mldnjava.cn)的讲座 Node.JS + MongoDB技术讲座 云计算 +大数据 ...
- stm32之通用定时器TIM
STM32系列的CPU,有多达8个定时器: 1.其中TMI1和TIM8是能够产生三对PWM互补输出的高级定时器,常用于三相电机的驱动:它们的时钟有APB2的输出产生: 2.其它6个为普通定时器,时钟由 ...
- CDMA电信短信猫支持189等电信号码可二次开发
CDMA电信短信猫支持189等电信号码可二次开发 这款短信猫采用法国wavecom Q2358C模块,支持短信猫二次开发,可提供短信猫二次开发包下载测试.提供相关资料文档. 此款CDMA电信短信猫有串 ...
- 在[self addsubView:xxx]中,self.name 和 _name的区别
在[self addsubView:xxx]中,self.name 和 _name的区别self.name 会调用重写的getter方法,而_name添加的只是_name 这个成员变量
- UIScrollView 滑动试图
UIScrollView --->UIView //创建UIScrollView testScrollView=[[UIScrollView alloc]init]; testScrollVie ...
- javaScript增加样式规则(新增样式)
<html> <head> <link rel="stylesheet" type="text/css" href="b ...
- JS正则表达式---分组
JS正则表达式---分组 之前写了一篇关于正则新手入门的文章,本以为对正则表达式相对比较了解 但是今天我又遇到了一个坑,可能是自己不够细心的原因吧,今天就着重和大家分享一下javascript正则表达 ...
- (原+转)ubuntu16中莫名死机及重新安装显卡驱动
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5992693.html 参考网址: http://blog.csdn.net/u012581999/ar ...
- (转+原)ipp "No dlls were found in the Waterfall procedure"
转自: http://blog.csdn.net/hua_007/article/details/9112909 1,吧 dll的目录放到系统环境变量中 intel 的官方推荐.验证是ok的. --- ...
- git commit的--amend选项
git commit --amend常常用来修改某个branch上最顶端的commit,大多数情况下,这个命令给人的感觉是用新的commit替换了原来的commit.git commit --amen ...