博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
杭电2122--Ice_cream's world III
阅读量:6153 次
发布时间:2019-06-21

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

Ice_cream’s world III

                                                   Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
                                                                               Total Submission(s): 1146    Accepted Submission(s): 379
Problem Description
ice_cream’s world becomes stronger and stronger; every road is built as undirected. The queen enjoys traveling around her world; the queen’s requirement is like II problem, beautifies the roads, by which there are some ways from every city to the capital. The project’s cost should be as less as better.
 
Input
Every case have two integers N and M (N<=1000, M<=10000) meaning N cities and M roads, the cities numbered 0…N-1, following N lines, each line contain three integers S, T and C, meaning S connected with T have a road will cost C.
 
Output
If Wiskey can’t satisfy the queen’s requirement, you must be output “impossible”, otherwise, print the minimum cost in this project. After every case print one blank.
 
Sample Input
2 1
0 1 10
 
4 0
 
Sample Output
10
impossible
 
Author
Wiskey
 
Source
 
Recommend
威士忌   |   We have carefully selected several similar problems for you:            
 
//并查集实现克鲁斯卡尔;
1 #include 
2 #include
3 using namespace std; 4 int father[1010] ; 5 6 struct rode 7 { 8 int a, b ,c; 9 };10 rode num[10010];11 12 bool cmp(rode a, rode b)13 {14 return a.c < b.c ;15 }16 17 int find(int a)18 {19 while(a != father[a])20 a = father[a];21 return a;22 }23 24 void mercy(int a, int b)25 {26 int q = find(a);27 int p = find(b);28 if(q != p)29 father[q] = p;30 31 }32 33 int main()34 {35 int i, n, m;36 while(~scanf("%d %d", &n, &m))37 {38 for(i=0; i

 

 

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

你可能感兴趣的文章
Ecshop安装过程中的的问题:cls_image::gd_version()和不支持JPEG
查看>>
resmgr:cpu quantum等待事件
查看>>
一个屌丝程序猿的人生(六十六)
查看>>
Java 编码 UTF-8
查看>>
SpringMVC实战(注解)
查看>>
关于静态属性和静态函数
查看>>
进程的基本属性:进程ID、父进程ID、进程组ID、会话和控制终端
查看>>
spring+jotm+ibatis+mysql实现JTA分布式事务
查看>>
MyBatis启动:MapperStatement创建
查看>>
调查问卷相关
查看>>
eclipse启动无响应,老是加载不了revert resources,或停留在Loading workbench状态
查看>>
1. Git-2.12.0-64-bit .exe下载
查看>>
怎样关闭“粘滞键”?
查看>>
[转]React 教程
查看>>
拓扑排序介绍
查看>>
eclipse打开工作空间(workspace)没有任务反应
查看>>
使用Sybmol模块来构建神经网络
查看>>
字符串去分割符号
查看>>
WPF中,多key值绑定问题,一个key绑定一个界面上的对象
查看>>
UML类图简明教程
查看>>