|
||||||||||
CC On The TreeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 2097 Accepted Submission(s): 744 Problem Description CC lives on the tree which has N nodes.On every leaf of the tree there is an apple(leaf means there is only one branch connect this node ) .Now CC wants to get two apple ,CC can choose any node to start and the speed of CC is one meter per second. now she wants to know the shortest time to get two apples; Input Thers are many cases; The first line of every case there is a number N(2<=N<=10000) if n is 0 means the end of input. Next there is n-1 lines,on the i+1 line there is three number ai,bi,ci which means there is a branch connect node ai and node bi. (1<=ai, bi<=N , 1<=ci<=2000) ci means the len of the branch is ci meters ; Output print the mininum time to get only two apple; Sample Input
Sample Output
Source | ||||||||||
|