传送门 题意: 给444个整数L,R,K,nL,R,K,nL,R,K,n,和nnn个数字串,L,R,K,数字串大小≤1e18,n≤65L,R,K,数字串大小\le1e18,n\le65L,R,K,数字串大小≤1e18,n≤65 问[L,R][L,R][L,R]中第KKK小的拥有nnn个数字串中至少一个串作为子串的数. 思路: 一看就要二分答案,现在考虑统计[L,R][L,R][L,R]中有多少个满足题意的数. 不妨考虑数位dpdpdp,然后发现没法很好的转移,为了优化转移可以对于所有的数字串构建…
咕咕(数位dp+AC自动机) 若一个字符串的字符集合是0~m-1,那么称它为m进制字符串.给出n个m进制字符串\(s_i\),每个字符串的权值为\(v_i\).对于另一个m进制字符串\(S\),设\(s_i\)在S中的出现次数是\(cnt_i\),那么\(s_i\)对\(S\)的价值的贡献就是\(v_i*cnt_i\).因此,\(V_S=\Sigma_{i=1}^kcnt_i\times v_i\).求在区间\([l, r]\)中,有多少字符串的价值不超过k.\(\Sigma_{i=1}^n|s…
Solution //本代码压掉后两维 #include<cstdio> #define max(a,b) (a<b?b:a) using namespace std; inline void read(int &x){ register ; ') ch=getchar(); +ch-',ch=getchar(); } ,M=; ; ,a[N],b[N];int bfs[N]; ],trans[N][]; int f[N][N][M]; inline void insert(in…
3530: [Sdoi2014]数数 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 834  Solved: 434[Submit][Status][Discuss] Description 我们称一个正整数N是幸运数,当且仅当它的十进制表示中不包含数字串集合S中任意一个元素作为其子串.例如当S=(22,333,0233)时,233是幸运数,2333.20233.3223不是幸运数.    给定N和S,计算不大于N的幸运数个数. Input 输入…
题目传送门 1 + 2 = 3? 发布时间: 2018年4月15日 22:46   最后更新: 2018年4月15日 23:25   时间限制: 1000ms   内存限制: 128M 描述 埃森哲是<财富>全球500 强企业之一,目前拥有约41.1 万名员工,服务于120 多个国家的4000 家企业.我们的客户既包括<财富>世界100 强中的94 家公司.<财富>世界500 强中3/4 以上的公司,也有世界上最大的国家政府机构.小Y 看到这样的介绍之后非常想加入公司,…
数位DP加二分 //数位dp,dfs记忆化搜索 #include<iostream> #include<cstdio> #include<cstring> using namespace std; typedef long long LL; #define N 20 LL dp[N][3];//dp[i][j]表示长度为i,前面有j个6时不含666的数的个数 int num[N]; //c6表示前面6的个数 LL dfs(int len, int c6, bool is…
题目传送门 B. Perfect Number time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We consider a positive integer perfect, if and only if the sum of its digits is exactly 1010. Given a positive integ…
传送门 参考资料: [1]:CodeForces 55D Beautiful numbers(数位dp&&离散化) 我的理解: 起初,我先定义一个三维数组 dp[ i ][ j ][ k ]:来到 i 位置时,所有非零数的lcm = j,当前数位 k 时含有的 Beautiful numbers 的个数. 但是,由题意得,当前的数 k 可以是个很大的数(9e18),数组根本就开不下,那怎么办呢? 将当前的数 hash 一下,如何hash呢? 假设 a,b,c,d 为[0,9]的数,那么不存…
SPOJ - BALNUM 题意: Balanced Numbers:数位上的偶数出现奇数次,数位上的奇数出现偶数次(比如2334, 2出现1次,4出现1次,3出现两次,所以2334是 Balanced Numbers) ,求一个区间内有多少Balanced Numbers. 解题思路:看题很容易想到数位dp,但是怎么记录某数字出现的次数呢?由于某数字出现的次数只与奇偶有关,与大小没有关系,所以我们可以分别用0,1,2来表示某数字没有出现,出现奇数次,出现偶数次,然后就可以用三进制来记录所有数字…
D. Beautiful numbers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if…