【数位DP】
墓华
这个作者很懒,什么都没留下…
展开
-
HDU - 4507 吉哥系列故事——恨7不成妻(数位DP求平方和)
链接:HDU - 4507 吉哥系列故事——恨7不成妻 题意: 如果一个整数符合下面3个条件之一,那么我们就说这个整数和7有关 1、整数中某一位是7; 2、整数的每一位加起来的和是7的整数倍; 3、这个整数是7的整数倍; 现在问题来了:吉哥想知道在一定区间内和7无关的数字的平方和。 分析: 设数位为:dlen−1dlen−2⋯d2d1d0d_{len-1}d_{len-2}\cdo...原创 2019-11-22 15:01:26 · 205 阅读 · 0 评论 -
CodeForces - 55D Beautiful numbers(数位DP)
题目链接:CodeForces - 55D Beautiful numbers Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of i...原创 2019-07-12 17:07:28 · 148 阅读 · 0 评论 -
[牛客竞赛] 处女座和小姐姐(三)(数位DP)
链接:https://ac.nowcoder.com/acm/contest/329/G 来源:牛客网 题目描述 经过了选号和漫长的等待,处女座终于拿到了给小姐姐定制的手环,小姐姐看到以后直呼666! 处女座其实也挺喜欢6这个数字的,实际上他做手环的时候选取的k=6。所以他对于包含数码6的数字极其敏感。每次看到像4567这样的数字的时候他的心就像触电了一样,想起了小姐姐。 现在你要给处女座展...原创 2019-01-27 13:17:59 · 148 阅读 · 0 评论 -
HDU - 4352 XHXJ's LIS(数位DP,二分法求LIS)
题目链接:HDU - 4352 XHXJ’s LIS Another hobby of xhxj is yy(speculation) some magical problems to discover the special properties. For example, when she see a number, she would think whether the digits of...原创 2019-07-18 17:24:26 · 183 阅读 · 0 评论 -
数位DP——小结及模板
一、数位DP 用于解决 范围 [L, R] 内满足某些条件的数有多少 的问题,所谓数位,就是指数的个位、十位、百位、千位… 一般会将先将求ans [L, R] 转化为求 ans [0, R] - ans [0, L-1] ,从而问题就变为数位DP求解 ans [0, X] 数位DP最重要的是状态的构建,而具体DP的过程则是利用DFS+记忆化搜索实现,这样更好理解并实现,而状态的构建则更像是状态的压...原创 2019-07-12 13:15:16 · 357 阅读 · 0 评论 -
CodeForces -1208F Bits And Pieces(位运算,贪心,SoS DP)
链接:CodeForces -1208F Bits And Pieces 题意: 给出一个长度为n  (3≤n≤106)n\;(3\le n\le 10^6)n(3≤n≤106) 的序列a1,a2,⋯ ,an  (0≤ai≤2⋅106)a_1,a_2,\cdots,a_n\;(0\le a_i\le 2\cdot1...原创 2019-08-27 17:02:39 · 766 阅读 · 0 评论