Toggle navigation
点码成金编程
F.A.Qs
ProblemSet
Source/Category
Status
Ranklist
Contest
Login
Home
=>
ProblemSet
=> 4.1-19:[MdOI R1]Path
Problem2140--4.1-19:[MdOI R1]Path
2140: 4.1-19:[MdOI R1]Path
Time Limit:
3
Sec
Memory Limit:
256 MB
Submit:
0
Solved:
0
[
Submit
] [
Status
] [ Creator:
][ 参考程序 ]
Description
Input
第一行一个整数 n,表示树上点的个数。
接下来 n−1 行,每行三个整数 x,y,w,表示编号为 x 和 y 的点之间有一条权值为 w 的边。
Output
一行一个整数,表示答案。
Sample Input
Copy
9 1 2 1 1 3 7 2 4 8 3 5 3 4 6 3 3 7 3 7 8 5 7 9 2
Sample Output
Copy
21
HINT
样例二:
输入:
3
1 2 2
2 3 1
输出:
2
Source/Category
数据结构
Trie