动态规划
文章平均质量分 76
Yi_Qing_Z
这个作者很懒,什么都没留下…
展开
-
LightOJ 1145 Dice (I) (动态规划+递推)
a[]数组:记录当前放了i个骰子后,可以到达的值对应的方法种数s[]数组:记录每放一个骰子后的前缀和以6个面的骰子为例,k=6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i=1 1 1 1 1 1 1 ...原创 2018-08-10 16:47:05 · 207 阅读 · 0 评论 -
2019牛客暑期多校训练营(第一场)E:ABBA
题面Bobo has a string of length 2(n + m) which consists of characters `A` and `B`. The string also has a fascinating property: it can be decomposed into (n + m) subsequences of length 2, and among the...转载 2020-11-11 15:13:34 · 143 阅读 · 0 评论 -
POJ 2096 Collecting Bugs(期望DP)
题面Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets a new program, he classifies all possible bugs int...原创 2020-11-11 15:08:33 · 711 阅读 · 0 评论 -
HDU 3535 AreYouBusy (多组背包综合)
题面Happy New Term!As having become a junior, xiaoA recognizes that there is not much time for her to AC problems, because there are some other things for her to do, which makes her nearly mad.What'...转载 2019-03-23 10:52:14 · 231 阅读 · 0 评论 -
HDU 3466 Proud Merchants (01背包+排序)
题面Recently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still very proud even if the...转载 2019-03-20 11:37:19 · 210 阅读 · 1 评论 -
Codeforces 559C Gerald and Giant Chess(dp+组合数)
题面Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in...转载 2019-02-18 20:22:17 · 338 阅读 · 0 评论 -
HDU - 1506 Largest Rectangle in a Histogram(DP)
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows...原创 2018-09-07 10:49:12 · 167 阅读 · 0 评论 -
ACM-ICPC 2018 南京赛区网络预赛 AC Challenge (dp+状态压缩)
Dlsj is competing in a contest with n(0<n≤20)n (0 < n \le 20)n(0<n≤20) problems. And he knows the answer of all of these problems.However, he can submit iii-th problem if and only if he has...原创 2018-09-06 20:17:51 · 176 阅读 · 0 评论 -
动态规划经典问题总结
子串和子序列子串:母串中连续的一段字符串子序列:所有元素都属于母串,并保留原来的顺序,但是元素在母串中不一定相邻子串一定是子序列,但子序列不一定是子串最大连续子串和求母串中最大的区间和,用dp[i]表示以i结尾的连续子串的最大和,若dp[i-1]<=0,dp[i]=a[i] 若dp[i-1]>0,dp[i]=dp[i-1]+a[i];即,以上一个元素...原创 2018-08-15 10:25:36 · 1248 阅读 · 1 评论 -
背包问题总结
N件物品,V容量,每件物品的代价v[i],价值w[i]01背包每种物品只能取一个,for i: 1 to N for j : V to v[i] f[j] = f[j-v[i]] + w[i];完全背包每种物品可以取无限个,但是体积不能超过V,for i: 1 to N for j = v[i] to V f[j] = f[j-v[i]] + w[i...原创 2018-08-14 21:28:59 · 156 阅读 · 0 评论 -
HDU 4089 Activation(概率dp)
题面After 4 years' waiting, the game "Chinese Paladin 5" finally comes out. Tomato is a crazy fan, and luckily he got the first release. Now he is at home, ready to begin his journey.But before start...原创 2019-08-05 20:28:01 · 186 阅读 · 0 评论