![](https://img-blog.csdnimg.cn/20190918140053667.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
ACM-数位DP
数位DP
luyehao1
ACMer
展开
-
B-number(数位DP+DFS记忆化搜索)
A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but 143 and 2639 are not. Your task is to calculate how many wqb-numbers fr原创 2017-10-17 16:38:17 · 619 阅读 · 0 评论 -
beautiful number(HDU 5179 数位DP)
Let A=∑ni=1ai∗10n−i(1≤ai≤9)(n is the number of A's digits). We call A as “beautiful number” if and only if a[i]≥a[i+1] when 1≤i<n and a[i] mod a[j]=0 when 1≤i≤n,i<j≤n(Such as 931 is a "beautiful number" while 87 isn't). Could you tell me the number of “bea原创 2017-10-27 22:34:22 · 324 阅读 · 0 评论 -
Bomb(HDU 3555 数位DP)
The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number sequence includes the sub-sequence "49", the power of the blast woul原创 2017-10-15 20:34:57 · 243 阅读 · 0 评论 -
F(x) (数位DP hdu4734)
For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 * 1. Now you are given two numbers A and B, please calculate how many numbers are there between 0 and B, inclusive, whose原创 2017-11-16 17:15:51 · 249 阅读 · 0 评论 -
The 2018 ACM-ICPC上海大都会赛 J Beautiful Numbers(数位dp)
题目链接: Beautiful Numbers 题意: 给定一个 n ,求 1 - n 中 Beautiful Numbers 的个数。一个数为 Beautiful Numbers 当且仅当它是它所有数位上数字和的倍数。 思路: 数位dp的关键在于定义dp数组以确保该数位上进行如此选择对答案的贡献是唯一的。 定义dp数组:dp[pos][sum][res] :sum表示各数...原创 2019-04-24 19:41:11 · 369 阅读 · 0 评论