Road System HUST 1631 最小生成树
2015-08-08 11:04
330 查看
B - Road System
Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld
& %llu
Submit Status Practice HUST
1631
Description
There are M cities in a map.Alice wants to find some roads to make all of the cities can be reached if she starts her journey from other cities.
With kind Bob's investigation and assessment, she got the resulting statistics about construction cost of some roads.However, her money is limited,
so she asks you to make a plan which costs the least to meet her goal.Can you help her?
Input
The first line contains an integer t meaning that there are T test cases(T <= 20).
For each test case:
The first line contains two integers, N and M, indicating the number of roads and cities. (0<=N<=100, 1<=M<=100).Then for each of the following N lines, there are three non-negative A, B, W, meaning that if a road is built between a and b, it costs w.(0<=w<=1000).
Output
For each test case, you need output a line containing an integer indicating the least cost of the plan, or if you can't get the answer with the information you're given, output "I'm not sure." instead.
Sample Input
Sample Output
题目连接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82557#problem/B
题目大意:
解题思路:
算法知识:
学习指导:
My参考代码:
Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld
& %llu
Submit Status Practice HUST
1631
Description
There are M cities in a map.Alice wants to find some roads to make all of the cities can be reached if she starts her journey from other cities.
With kind Bob's investigation and assessment, she got the resulting statistics about construction cost of some roads.However, her money is limited,
so she asks you to make a plan which costs the least to meet her goal.Can you help her?
Input
The first line contains an integer t meaning that there are T test cases(T <= 20).
For each test case:
The first line contains two integers, N and M, indicating the number of roads and cities. (0<=N<=100, 1<=M<=100).Then for each of the following N lines, there are three non-negative A, B, W, meaning that if a road is built between a and b, it costs w.(0<=w<=1000).
Output
For each test case, you need output a line containing an integer indicating the least cost of the plan, or if you can't get the answer with the information you're given, output "I'm not sure." instead.
Sample Input
1 3 3 1 2 1 1 3 2 2 3 4
Sample Output
3
题目连接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82557#problem/B
题目大意:
解题思路:
算法知识:
学习指导:
My参考代码:
相关文章推荐
- Java容器
- c++自定义string类
- activemq in action
- 取石子游戏(hdu2516+FIB博弈)
- 面试题:在一个数组中除两个数字只出现1次外,其它数字都出现了2次, 要求尽快找出这两个数字
- ORACLE 定时执行存储过程
- [算法专题] 深度优先搜索&回溯剪枝
- 南邮 OJ 2074 pdf的旅游
- windows server 2008 R2设置远程访问用户数
- 3126POJ
- [CareerCup] 4.8 Contain Tree 包含树
- .net 架构师/经理招聘,长期有效
- [算法专题] 深度优先搜索&回溯剪枝
- sublime学习心得
- UIAlertView 实现自动消失
- 南邮 OJ 2073 FFF
- 支撑4.5亿活跃用户的WhatsApp架构概览
- 30.表视图(UITableView)和界面传值
- Google 镜像站搜集[转]
- sublime学习心得