Meaning
For a tree n nodes, the node number is 1~n and the root node is 1. Each side is entitled to a value, cut off a side to spend cost (W)
To cut off some edges so that each leaf node can not go to the root node.
Request to cut off the sum of the costs can not exceed the case of M, so that each side to spend the upper limit as low as possible
Ideas
Two points can be chopped off the edge of the upper limit, and then the tree DP
F[i]: Represents the minimum cost of allowing all leaf nodes of the I subtree to reach the I point
F[i] = sum {min (w (i,v), f[v]) | V is son of I node}
And this problem has a upper limit weight, that is, the weight value is greater than the upper limit can not be cut.
So the shift over there needs to be changed.
if (w (i, v) > Upper limit) f[i] + = F[v];
else F[i] + = min (w (i,v), f[v]);
And then, if f[1]<=m, then this upper limit is eligible.
This problem, if initialized with the INF, then the INF must be greater than the maximum value of M 1000000