HDU 3271-SNIBB(数位dp)】的更多相关文章

思路:dp[i][j]:表示第i位在B进制下数字和. 用二分找第k个数! 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include<vector> #define ll __int64 using namespace std; ][],…
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&…
SNIBB Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 327164-bit integer IO format: %I64d      Java class name: Main     As we know, some numbers have interesting property. For example, any even number has th…
1.HDU 2089  不要62    简单数位dp 2.总结:看了题解才敲出来的,还是好弱.. #include<iostream> #include<cstring> #include<cstdio> using namespace std; ][]; //dp[i][j]表示以j为首位符合条件的i位数的个数 void init() //预处理 { memset(dp,,sizeof(dp)); dp[][]=; ;i<;i++){ ;j<;j++){…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=3555 Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 15372    Accepted Submission(s): 5563 Problem Description The counter-terrorists f…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=4734 F(x) Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4389    Accepted Submission(s): 1614 Problem Description For a decimal number x with…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3555 Bomb Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) 问题描述 The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bo…
题意: 我们定义十进制数x的权值为f(x) = a(n)*2^(n-1)+a(n-1)*2(n-2)+...a(2)*2+a(1)*1,a(i)表示十进制数x中第i位的数字. 题目给出a,b,求出0~b有多少个不大于f(a)的数. 思路: 数位DP,用来学习数位DP了. <数位DP> 所谓数位DP就是基于考虑数字的每一位来转移的DP. 例如求比456小的数,可以这么考虑, 4          5               6   4       5             (0~6) 4…
### HDU 6148 题目链接 ### 题目大意: 众所周知,度度熊非常喜欢数字. 它最近发明了一种新的数字:Valley Number,像山谷一样的数字. 当一个数字,从左到右依次看过去数字没有出现先递增接着递减的“山峰”现象,就被称作 Valley Number.它可以递增,也可以递减,还可以先递减再递增.在递增或递减的过程中可以出现相等的情况. 比如,1,10,12,212,32122都是 Valley Number. 121,12331,21212则不是. 度度熊想知道不大于N的Va…
hdu 3652 题意:求1到n中包含'13'('13'不一定连续)且能被13整除的数的个数. 这是我第一道比较了能看懂的数位dp.定义状态dp[pos][res][sta]表示处理到第pos位,模的余数为0,sta取0,1,2,0表示无'13',1表示有1无3,2表示有'13'. 特别注意就是16行只要i==1时,nsta就是1,不用加sta=0,否则会WA.... #include<iostream> #include<cstring> using namespace std;…