上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: 题目意思:要求数字偶数数位出现基数次,基数数位出现偶数次,不出现,不违反规则。状态压缩:3进制数 0表示未出现过 1表示出现基数次 2表示出现偶数次 1 #include<iostream> 2 #include<cstring> 3 #include<cstdlib> 4 #include<cstdio> 5 #include<algorithm> 6 #include<cmath> 7 using std::cin; 8 using std::endl; 9 using std::cout;10 typedef lon 阅读全文
posted @ 2013-05-22 15:39 诺小J 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 101010属于周期循环的二进制,循环次数为3现在给你十进制的区间,求出有周期循环的数的个数思路: 枚举循环的周期的长度,但注意周期长度所包含的因子长度不能重复计算。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 typedef long long LL; 6 int const N = 70; 7 LL dp[N],p2[N]; 8 int bit[N],ln; 9 void pre()10 {11 p2[0]=1;12 for 阅读全文
posted @ 2013-05-21 19:29 诺小J 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 题意:1245 这个数属于上升长度为4的数字,1213这个数字属于上升长度为3的数字。统计区间[l,r]中上升长度为k的数字个数。State 状态压缩,表示最长上升的序列用到的数字有哪些 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 typedef long long LL; 6 int const N = 22; 7 int const M = 1030; 8 int bit[N],ln,pow2[11],k; 9 LL dp[ 阅读全文
posted @ 2013-05-21 19:25 诺小J 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 主要是记录一个flag,表示现在距离幸运位的位置有多远,然后做一下记忆化的搜索就OK了。。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 #include<cmath> 6 #define MOD 1000000007 7 using namespace std; 8 typedef long long LL; 9 int const N = 2010;10 int ln,k;11 char bitl 阅读全文
posted @ 2013-05-10 11:06 诺小J 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 统计n以下所有有x次4和y次7的数的个数,然后二分。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 using namespace std; 6 typedef long long LL; 7 int const N = 22; 8 int const M = 22; 9 LL dp[N][N][N];10 int bit[N],ln;11 int x,y;12 LL getsum1(int t,int limi 阅读全文
posted @ 2013-05-09 19:37 诺小J 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 其实我不知道要说什么,因为这道题的解法也是从别人那里看的,不想盗版,看看这位神牛的吧,讲得挺不错,就是要好生理解一下。http://blog.csdn.net/xymscau/article/details/6688671View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 typedef long long LL; 6 int const N = 33; 7 LL dp[N],pow2[N]; 8 void pre( 阅读全文
posted @ 2013-05-09 15:32 诺小J 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页