博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
杭电2120--Ice_cream's world I(并查集)
阅读量:6368 次
发布时间:2019-06-23

本文共 1669 字,大约阅读时间需要 5 分钟。

Ice_cream's world I

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 758    Accepted Submission(s): 442

Problem Description
ice_cream's world is a rich country, it has many fertile lands. Today, the queen of ice_cream wants award land to diligent ACMers. So there are some watchtowers are set up, and wall between watchtowers be build, in order to partition the ice_cream’s world. But how many ACMers at most can be awarded by the queen is a big problem. One wall-surrounded land must be given to only one ACMer and no walls are crossed, if you can help the queen solve this problem, you will be get a land.
 

 

Input
In the case, first two integers N, M (N<=1000, M<=10000) is represent the number of watchtower and the number of wall. The watchtower numbered from 0 to N-1. Next following M lines, every line contain two integers A, B mean between A and B has a wall(A and B are distinct). Terminate by end of file.
 

 

Output
Output the maximum number of ACMers who will be awarded.
One answer one line.
 

 

Sample Input
8 10
0 1
1 2
1 3
2 4
3 4
0 5
5 6
6 7
3 6
4 7
 

 

Sample Output
3
 

 

Author
Wiskey
 

 

Source
 

 

Recommend
威士忌   |   We have carefully selected several similar problems for you:            
//计算成环个数;
1 #include 
2 int father[1010]; 3 int find(int a) 4 { 5 while(a != father[a]) 6 a = father[a]; 7 return a; 8 } 9 void mercy(int a, int b)10 {11 int q = find(a);12 int p = find(b);13 if(q != p)14 father[q] = p;15 }16 int main()17 {18 int i, n, m;19 while(~scanf("%d %d", &n, &m))20 {21 int total = 0;22 for(i=0; i

 

转载于:https://www.cnblogs.com/soTired/p/4680340.html

你可能感兴趣的文章
猫头鹰的深夜翻译:spring事务管理
查看>>
记一次使用Spring REST Docs + travis + github自动生成API接口文档的操作步骤(下)...
查看>>
1、集合 2、Iterator迭代器 3、增强for循环 4、泛型
查看>>
关于/var/run/docker.sock
查看>>
SCrapy爬虫大战京东商城
查看>>
用 JavaScript 实现链表操作 - 11 Alternating Split
查看>>
Laravel优秀扩展包整理
查看>>
日志分析之识别真假蜘蛛与处理办法
查看>>
太多脚本将会毁掉持续交付
查看>>
一地鸡毛 OR 绝地反击,2019年区块链发展指南
查看>>
卢森堡大学发布RepuCoin系统,可破解区块链51%攻击
查看>>
国内云计算厂商众生相:四大阵营十几家企业生存盘点
查看>>
细说Unicode(一) Unicode初认识
查看>>
Node.js有了新的管理者
查看>>
Java 20年:历史与未来
查看>>
彻底理解Javascript中的原型链与继承
查看>>
腾讯最大规模裁撤中层干部,让贤年轻人
查看>>
gRPC-Web发布,REST又要被干掉了?
查看>>
如何:强化 TCP/IP 堆栈安全
查看>>
Spring3 MVC中使用Swagger生成API文档
查看>>