ZOJ Problem Set - 3684
DJT country and CG country are always on wars.
CG, of course, won't let DJT be happy for too long. CG is now planning to destroy DJT's new system. Due to some great undercover agents, CG has controlled some information about DJT's new system. The information CG has got:
Now, CG gives you a task: calculate the minimum power to destroy the system.
There are multiple cases. For each case, one integer n (0 <= n <= 10000) indicating the number of cities in DJY country, cities are numbered from 1 to n, the next n-1 lines, one line contains four numbers describing one road, the two cities connected by the road, the length, and the power needed to destroy. The lengths are less than or equal to 10000. The powers are less than or equal to 100000000. All integers are nonnegative.
For each case, output one number indicating the least power we need.
9 1 4 1 3 2 3 1 7 2 5 1 2 4 5 1 5 5 6 1 4 5 8 1 4 6 9 1 4 7 8 1 6
Author: HE, Ningxu
Contest: ZOJ Monthly, January 2013