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

PROGRAMMING:Father son game

Luz5年前 (2021-05-10)题库472
As we all know, Keven is always happy at the top of the canyon. This time, they got into DH's father son game. Of course, they are going to lose. DH direct switch, pull the cable at one go, skillfully distressing. Keven doesn't want to give up struggling yet. He wants to ask you how to make his network connect with everyone. He has a direct access to any network, and the cost is minimal.
The simplification problem is that there are $$n $$nodes (from 1 to $$n $$number, Keven txdy, so he is No. 1), and there are m edges connected with each other at the cost of $$W_{ i,j}$$ 。 Ask you the minimum cost for Keven to connect with all nodes.
###Input format:
The first line contains two integers $$n $$, $$M $$(1 < = $$n $$< = 100000, 1 < = $$M $$< = 500000)
Next, $$M $$line, three integers in each line, $$a, B, C $$indicates the cost of establishing a connection between $$a, B $$($$1 < = a, B < = n $$, $$1 < = C < = 1000 $$)
###Output format:
Output the minimum cost in one line. If it cannot be connected, output "DH yyds" (without double quotation marks)
###Input example:
Here is a set of inputs. For example:
```in
5 8
4 5 9
3 3 4
3 4 10
3 3 10
3 5 7
3 1 4
4 4 4
2 4 9
```
###Output example:
The corresponding output is given here. For example:
```out
twenty-nine
```







answer:If there is no answer, please comment