区间DP和树形DP(8.3)
qq_39479426
井底之蛙
展开
-
CSU1592
现在有n堆石子,第i堆有ai个石子。现在要把这些石子合并成一堆,每次只能合并相邻两个,每次合并的代价是两堆石子的总石子数。求合并所有石子的最小代价。 Input 第一行包含一个整数T(T<=50),表示数据组数。 每组数据第一行包含一个整数n(2<=n<=100),表示石子的堆数。 第二行包含n个正整数ai(ai<=100),表示每堆石子的石子数。 Out...原创 2018-08-08 23:43:52 · 116 阅读 · 0 评论 -
HDU1520
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tr...原创 2018-08-08 23:49:32 · 307 阅读 · 0 评论 -
POJ1651
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points equal to the pr...原创 2018-08-08 23:53:41 · 330 阅读 · 0 评论 -
Codeforces607B
Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as qui...原创 2018-08-09 00:08:46 · 209 阅读 · 0 评论 -
HDU1561
ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多的宝物应该攻克哪M个城堡吗? Input 每个测试实例首先包括2个整数,N,M.(1 <= M <= N <= 200)...原创 2018-08-09 00:17:53 · 504 阅读 · 0 评论