HBC52821SequeHBCeGame,动态规划Defense Tower题解

一点都不欢乐 算法提高篇 65 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。

In ICPCCamp, there are n cities and (n - 1) (bidirectional) roads between cities. The i-th road is between the a_i a i ​ -th and b_i b i ​ -th cities. It is guaranteed that cities are connected. In the i-th city, there is a defense tower with power p_i p i ​ . The tower protects all cities with a road directly connected to city i. However, the tower in city i does not protect city i itself. Bobo would like to destroy all defense towers. When he tries to destroy the tower in city i, any not-destroyed tower protecting city i will deal damage whose value equals to its power to Bobo. Find out the minimum total damage Bobo will receive if he chooses the order to destroy the towers optimally.

全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC52821SequeHBCeGame 动态规划Defense Tower题解