随笔分类 - 动态规划
摘要:排个序,从小到大扫,如果当前这个不能被前面那些小的表示,则加入货币系统。与bzoj某权限的一道POI题有点像,只是那题只能用一次。
阅读全文
摘要:总数是偶数并且其一半可得即可。 bitset的移位可替代原本的数组转移。
阅读全文
摘要:1.不要贪,缩小区间去dp就好。 2.预处理指数。 3.__int128可还行。
阅读全文
摘要:简单入门版:洛谷1280 时间交叉和倒序处理的思路是相同的,相较之下此题更多的条件是:1.每个任务可以在很多个时间点中选一个去做;2.会有捣乱。 解决方法:1.每个时间点选哪个根据规则的话是固定的可预处理,但这样会发现某一段时间都是选的那个最大的,然鹅实际上只能选一次对吧。但其实没问题,很难讲,总之
阅读全文
摘要:题目性质:1.当前节点空闲则必须做任务,而不是可选可不选;2.然而前面的如果能覆盖当前节点,就可以不选。 解决方法:倒着扫可以很好地解决这两个问题。dp[i]为时刻i可得的最大空闲时间。如果此刻没有任务,则空闲时间+1;否则最大空闲时间等于任务结束节点的最大空闲时间: 总代码main:
阅读全文
摘要:一道简单的树形DP送给你。 A couple of years ago, a new world wide crisis started, leaving many people with economical problems. Some workers of a particular compa
阅读全文
摘要:今天带来一个简单的线性结构上的DP,与上次的照明系统(UVA11400)是同一种类型题,便于大家类比、总结、理解,但难度上降低了。 We say a sequence of characters is a palindrome if it is the same written forwards a
阅读全文
摘要:You are given the task to design a lighting system for a huge conference hall. After doing a lot of calculation and sketching, you have figured out the
阅读全文
摘要:上一次紫芝详细地介绍了动态规划中的经典问题LIS,今天我们抽出一个类似思想的简单题目进行实践练习。 The Tower of Babylon(巴比伦塔) Perhaps you have heard of the legend of the Tower of Babylon. Nowadays ma
阅读全文
摘要:Recently, Shua Shua had a big quarrel with his GF. He is so upset that he decides to take a trip to some other city to avoid meeting her. He will trav
阅读全文