HDU 3271 数位dp+二分】的更多相关文章

SNIBB Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1485    Accepted Submission(s): 435 Problem Description   As we know, some numbers have interesting property. For example, any even number h…
K-th Nya Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 3155    Accepted Submission(s): 1021 Problem Description Arcueid likes nya number very much.A nya number is the number which has…
http://acm.hdu.edu.cn/showproblem.php?pid=4507 Problem Description 单身! 依旧单身! 吉哥依旧单身! DS级码农吉哥依旧单身! 所以.他生平最恨情人节,无论是214还是77.他都讨厌! 吉哥观察了214和77这两个数,发现: 2+1+4=7 7+7=7*2 77=7*11 终于,他发现原来这一切归根究竟都是由于和7有关!所以,他如今甚至讨厌一切和7有关的数. 什么样的数和7有关呢? 假设一个整数符合以下3个条件之中的一个.那么我…
XHXJ's LIS Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2265    Accepted Submission(s): 927 Problem Description #define xhxj (Xin Hang senior sister(学姐)) If you do not know xhxj, then careful…
/** 题目:poj3208 Apocalypse Someday 链接:http://poj.org/problem?id=3208 题意:求第K(K <= 5*107)个有连续3个6的数. 思路:数位dp+二分. dp[i][j]表示长度为i,前缀状态为j时含有的个数. j=0表示含有前导0: j=1表示前缀连续1个6 j=2表示前缀连续2个6 j=3表示前缀连续3个6 j=4表示前缀不是6: */ //#include<bits/stdc++.h> #include<cstr…
题目链接: http://hihocoder.com/problemset/problem/1301?sid=804672 题解: 二分答案,每次判断用数位dp做. #include<iostream> #include<cstring> #include<cstdio> using namespace std; typedef long long LL; const LL INFLL = 0x3f3f3f3f3f3f3f3fLL; //dp[x][0]表示高位还没有出…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6156 题意:如题. 解法:数位DP,暴力枚举进制之后,就转化成了求L,R区间的回文数的个数,这个直接做一个数位DP就好了.dp[jz][start][cur][state]表示jz进制下以start位起始到cur位状态为state(1表示已经回文,0表示没有回文)时回文数的个数. #include <bits/stdc++.h> using namespace std; typedef long…
积累点: 1: (l&r)+((l^r)>>) == (l+r)/2 2: 注意判断现在是否有限制.当枚举下一个量时,是(isQuery && j==end),不要搞错. 传送门:http://acm.upc.edu.cn/problem.php?id=2223 题意: 能被7整除或者含7的数称为A-Number,所有A-Number从小到大写好,下标编号(从1开始),去掉那些下标为A-Number的数,剩下的数称为B-Number.求第N个B-Number是多少. 思…
All submissions for this problem are available. Chef likes numbers and number theory, we all know that. There are N digit strings that he particularly likes. He likes them so much that he defines some numbers to be beautiful numbers based on these di…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2089 数位dp的模板题,统计一个区间内不含62的数字个数和不含4的数字个数,直接拿数位dp的板子敲就行,注意每次调用solve函数要初始化dp数组,否则之前调用的时候dp数组可能被记录过. AC代码: #include<iostream> #include<cmath> #include<algorithm> #include<cstdio> #include&…