摘要: Start with an integer,N0, which is greater than 0. LetN1be the number of ones in the binary representation ofN0. So, ifN0= 27,N1= 4. For alli> 0, letNibe the number of ones in the binary representation ofNi-1. This sequence will always converge to one. For any starting number,N0, letKbe the minim 阅读全文
posted @ 2013-05-08 17:03 诺小J 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 说白了,只要求出1-x中出现666子串的数字,然后二分枚举答案。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 typedef long long LL; 6 int const N = 20; 7 LL dp1[N][N][N],dp2[N][N][N]; 8 int bit[N],ln; 9 LL getsum1(int t,int pre,int last,int flag,int limit)10 {11 阅读全文
posted @ 2013-05-08 14:54 诺小J 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 枚举数位之和,然后取磨直到最后,记忆化减少时间复杂度。View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cstdlib> 4 #include<cstdio> 5 typedef long long LL; 6 int const N = 11; 7 int const M = 82; 8 int dp[N][M][M][M]; 9 int bit[N],l,uup;10 int getsum1(int t,int pre,int sum,int limit,int res 阅读全文
posted @ 2013-05-08 13:18 诺小J 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 统计数字当中出现13的子串,并且能被13整除的数字。逐位确定一下就Ok了,然后加好其他限定条件,减少时间复杂度用记忆化。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 typedef long long LL; 6 int const N = 20; 7 int const M = 15; 8 int bit[N],l; 9 LL dp1[N][M][M],dp2[N][M][M];10 LL getsum1(i 阅读全文
posted @ 2013-05-08 12:23 诺小J 阅读(144) 评论(0) 推荐(0) 编辑