P1273 cable networks (Los Valley)

  I started this question is not, then read the solution to a problem, a packet dp knapsack problem, then understand, here to talk about ideas :( meaning of the questions for yourself)

  Is represented by D (i, j, k) to the subtree root node j, k nodes selected maximum benefit obtained in the previous i-th node, is defined as the apparent problem so transformed,

  Satisfies d (i, j, k)> = 0 can be considered the last (j == 1, that is to say the first large root), even though other <we also need to consider (and composition may further node i + x number

  It is> = 0, and the state transition equation is then: d (i, j, k ) = max (d (i-1, j, k), d (i-1, j, k -...) + d (.., v (child nodes), ....) the state transition equation is defined metaphysics, anyway, look at this solution to a problem it wants https://www.luogu.org/problemnew/solution/P1273 (written by better than me), omit the code (how do I so lazy.)

Guess you like

Origin www.cnblogs.com/yifeiWa/p/11469303.html