-->
当前位置:首页 > 题库

PROGRAMMING:Calculate the minimum spanning tree weight

Luz5年前 (2021-05-10)题库435
This problem requires the use of prim algorithm to find the minimum spanning tree, output the sum of its weights
###Input format:
The input is the vertex weight, which ends with 0
###Output format:
The output is the weight size of the minimum spanning tree
###Input example:
```in
0 1 5
1 0 5
0 2 30
2 0 30
0 3 14
3 0 14
1 2 24
2 1 24
2 3 17
3 2 17
1 4 14
4 1 14
1 5 10
5 1 10
4 5 25
5 4 25
2 5 17
5 2 17
3 5 8
5 3 8
0 0 0
```
###Output example:
The corresponding output is given here. For example:
```out
fifty-four
```







answer:If there is no answer, please comment