2013年9月13日

摘要: http://www.lightoj.com/volume_showproblem.php?problem=1125 1 #include 2 #include 3 #include 4 using namespace std; 5 #define N 205 6 #define LL long long 7 LL dp[N][11][21][21]; 8 LL num[N]; 9 void init(int n)10 {11 memset(dp,0,sizeof(dp));12 for(int k=1;k<=20;k++){13 LL c=2100000... 阅读全文
posted @ 2013-09-13 20:48 kim888168 阅读(213) 评论(0) 推荐(0) 编辑

2013年9月9日

摘要: http://www.lightoj.com/volume_showproblem.php?problem=1168 1 #include 2 #include 3 #include 4 using namespace std; 5 #define N 1005 6 struct{ 7 int y,next; 8 }ee[10*N]; 9 struct{ 10 int a,b; 11 }mes[10*N]; 12 int link[N],dfn[N],low[N],pos[N],stack[N],t,st,bct,ind,in[N],out[N]; 13... 阅读全文
posted @ 2013-09-09 12:21 kim888168 阅读(417) 评论(0) 推荐(0) 编辑

2013年9月7日

摘要: http://www.lightoj.com/volume_showproblem.php?problem=1044 1 #include 2 #include 3 #include 4 using namespace std; 5 #define N 1005 6 struct op{ 7 int a,b,len; 8 }mes[N*N]; 9 int dp[N],ct,n;10 char s[N];11 bool map[N][N];12 void init()13 {14 memset(map,0,sizeof(map));15 n=strlen(s+1);... 阅读全文
posted @ 2013-09-07 09:48 kim888168 阅读(246) 评论(0) 推荐(0) 编辑

2013年8月23日

摘要: 题意:将一个数划分成两部分,如果过分出来的两部分相加能被k整除,则这种划分时可行的,题目要我们求的是一段区间内的数有多少种可行的划分方法(PS:一个数可以有多种划分方法,如333 3有两种分别是33|3 , 3|33)http://acm.hdu.edu.cn/showproblem.php?piddp[i][j][k][l]表示处理到第i位,划分位置为j,除数为k,余数为l的,划分方法数。 1 #include 2 #include 3 #include 4 using namespace std; 5 #define ll __int64 6 ll dp[18][18][22][22... 阅读全文
posted @ 2013-08-23 10:32 kim888168 阅读(282) 评论(0) 推荐(0) 编辑

2013年8月16日

摘要: http://www.lightoj.com/volume_showproblem.php?problem=1205求区间内的回文数个数。。。 1 #include 2 #include 3 #include 4 using namespace std; 5 #define ll long long 6 ll dp[19][10],num[18]; 7 void init() 8 { 9 memset(dp,0,sizeof(dp));10 dp[0][0]=1;11 num[0]=1;12 num[1]=10;13 for(int i=0;i=0... 阅读全文
posted @ 2013-08-16 00:33 kim888168 阅读(275) 评论(0) 推荐(0) 编辑

2013年8月15日

摘要: http://www.lightoj.com/volume_showproblem.php?problem=1068类型:数位DP 1 #include 2 #include 3 #include 4 using namespace std; 5 #define ll unsigned int 6 ll dp[83][11][83][83],md[12]={1}; 7 void init() 8 { 9 memset(dp,0,sizeof(dp));10 for(int i=1;i1;i--){42 for(int j=0;j82)68 ... 阅读全文
posted @ 2013-08-15 18:10 kim888168 阅读(242) 评论(0) 推荐(0) 编辑

2013年8月12日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3943题目意思是说一个数字由X个4和Y个7和其他不包含4和7的数字组成,则这个数是Nya数,求给定区间的第K个Nya数。 1 #include 2 #include 3 #include 4 using namespace std; 5 #define N 25 6 #define ll __int64 7 ll dp[N][N][N],p,q,x,y; 8 void init() 9 {10 memset(dp,0,sizeof(dp));11 dp[0][0][0]=1;12 ... 阅读全文
posted @ 2013-08-12 19:24 kim888168 阅读(205) 评论(0) 推荐(0) 编辑
 
摘要: 题目要求的是求出1~n里能被13整除且含有“13"的数字的个数。。。 1 #include 2 #include 3 #include 4 using namespace std; 5 int dp[15][10][14][3],md[15]={ 6 0,1 7 }; 8 void init() 9 {10 for(int i=2;i=1;i--){46 pre=(pre+dig[i+1]*md[i+1])%13;47 for(int j=0;j<dig[i];j++){48 if(flag)49 ... 阅读全文
posted @ 2013-08-12 13:32 kim888168 阅读(147) 评论(0) 推荐(0) 编辑

2013年8月11日

摘要: http://acm.uestc.edu.cn/problem.php?pid=1307中文题不解释。。。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int dp[15][10]; 7 void init() 8 { 9 memset(dp,0,sizeof(dp));10 for(int i=0;i=2)16 dp[i][j]+=dp[i-1][k];17 }18 19 }20 int solve(int x)21 {22 i... 阅读全文
posted @ 2013-08-11 14:51 kim888168 阅读(205) 评论(0) 推荐(0) 编辑

2013年7月24日

摘要: 给出一棵树,求出树中的最长连。。。 1 #include 2 #include 3 #include 4 using namespace std; 5 #define maxn 40005 6 struct{ 7 int y,c,next; 8 }ee[maxn<<1]; 9 int link[maxn],t,root1,k;10 void insert(int a,int b,int c)11 {12 ee[++t].y=b;13 ee[t].c=c;14 ee[t].next=link[a];15 link[a]=t;16 }17 void d... 阅读全文
posted @ 2013-07-24 12:27 kim888168 阅读(175) 评论(0) 推荐(0) 编辑