| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11707 | DS_2017fall_Quiz4 |
|
Description
In Quiz4, we will give you a undirected weighted graph.
You have to find out the minimum spanning tree, and then output the sum of the edge cost.
Note:
1.There is no self-loop in graph.
2.No duplicate edges between two vertices.
3.All the edges and vertices are positive integer.
4.All the vertices in the graph will be connected.
Each vertice and edge weighted is an integer ranging from 1 to 1000.
In testcase1, there won't be loop in the graph.
Input
There are many line in input, and its format will be:
vertex1 vertex2 edge_weight
vertex1 vertex2 edge_weight
vertex1 vertex2 edge_weight
............
ex:
1 2 3
2 3 4
Output
You only have to output the sum of minimum weight.
ex:
7