![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划——数位 DP
Alex_McAvoy
想要成为渔夫的猎手
展开
-
动态规划 —— 数位 DP
【概述】数位 DP 实际是一种计数用的 DP,一般就是统计一个区间 [le,ri] 内满足一些条件数的个数。所求的限定条件往往与数的位数有关,例如:数位之和、指定数码个数、数的大小顺序分组等。题目所给的区间范围往往很大,无法通过暴力枚举来求解,一般是要求把某个区间的符合某种特征的数的个数求出来,因此根据根据 “逐位确定” 的基本思想,将最大数按位分解,然后 dfs 依次判断每一位相应的...原创 2018-09-04 20:00:55 · 732 阅读 · 0 评论 -
Fast Bit Calculations(LightOJ-1032)
Problem DescriptionA bit is a binary digit, taking a logical value of either 1 or 0 (also referred to as "true" or "false" respectively). And every decimal number has a binary representation which ...原创 2019-01-22 17:24:05 · 331 阅读 · 0 评论 -
处女座和小姐姐(三)
【题目描述】经过了选号和漫长的等待,处女座终于拿到了给小姐姐定制的手环,小姐姐看到以后直呼666!处女座其实也挺喜欢6这个数字的,实际上他做手环的时候选取的k=6。所以他对于包含数码6的数字极其敏感。每次看到像4567这样的数字的时候他的心就像触电了一样,想起了小姐姐。现在你要给处女座展示一系列数字,你想知道他的内心会激动多少次。对于同一个数字,他最多只会激动一次,即如果这个数是66...原创 2019-01-26 18:18:15 · 545 阅读 · 1 评论 -
Magic Numbers(CF-628D)
Problem DescriptionConsider the decimal presentation of an integer. Let's call a number d-magic if digit d appears in decimal presentation of the number on even positions and nowhere else.For exa...原创 2019-01-17 10:40:53 · 421 阅读 · 0 评论 -
windy数(BZOJ-1026)
Problem Descriptionwindy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。 windy想知道,在A和B之间,包括A和B,总共有多少个windy数?Input包含两个整数,A BOutput一个整数Sample Input1 1025 50Sample Output920思路:设 dp...原创 2018-09-10 22:55:33 · 374 阅读 · 0 评论 -
K-th Nya Number(HDU-3943)
Problem DescriptionArcueid likes nya number very much. A nya number is the number which has exactly X fours and Y sevens(If X=2 and Y=3 , 172441277 and 47770142 are nya numbers.But 14777 is not a n...原创 2018-09-12 21:05:39 · 345 阅读 · 0 评论 -
Balanced Numbers(SPOJ-BALNUM)
Problem DescriptionBalanced numbers have been used by mathematicians for centuries. A positive integer is considered a balanced number if:1) Every even digit appears an odd number of times i...原创 2018-09-12 20:31:47 · 407 阅读 · 0 评论 -
Amount of Degrees(Ural-1057)
Problem DescriptionCreate a code to determine the amount of integers, lying in the set [ X; Y] and being a sum of exactly K different integer degrees of B.Example. Let X=15, Y=20, K=2, B=2. By thi...原创 2018-09-05 19:57:02 · 363 阅读 · 0 评论 -
Apocalypse Someday(POJ-3208)
Problem DescriptionThe number 666 is considered to be the occult “number of the beast” and is a well used number in all major apocalypse themed blockbuster movies. However the number 666 can’t alwa...原创 2018-09-08 22:31:19 · 239 阅读 · 0 评论 -
F(x)(HDU-4734)
Problem DescriptionFor a decimal number x with n digits (An An-1 An-2 ... A2 A1), 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...原创 2018-09-05 19:29:37 · 317 阅读 · 0 评论 -
Balanced Number(HDU-3709)
Problem DescriptionA balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the d...原创 2018-09-05 19:25:55 · 387 阅读 · 0 评论 -
B-number(HDU-3652)
Problem DescriptionA 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-number...原创 2018-09-04 20:46:05 · 163 阅读 · 0 评论 -
Bomb(HDU-3555)
Problem DescriptionThe 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 curre...原创 2018-09-04 20:32:20 · 350 阅读 · 0 评论 -
不要62(HDU-2089)
Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有6和2,但...原创 2018-09-04 20:13:29 · 796 阅读 · 0 评论 -
数字0-9的数量(51Nod-1042)
题目给出一段区间a-b,统计这个区间内0-9出现的次数。比如 10-19,1出现11次(10,11,12,13,14,15,16,17,18,19,其中11包括2个1),其余数字各出现1次。输入两个数a,b(1 <= a <= b <= 10^18)输出输出共10行,分别是0-9出现的次数输入样例10 19输出样例1111111...原创 2019-04-15 21:27:23 · 545 阅读 · 0 评论