摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3652View Code //dp[i][j][3] //表示前i个字符,余数为j //0 存在13,1前一个是1 ,2什么都没有const int MM = 1111;typedef __int64 int64;#define debug puts("wrong")#define mod 13int N,M;int num[MM], cnt;int dp[11][15][3]; //0 have 13 // 1 pre=1 // 2 noint dfs(int le,int r,int 阅读全文
posted @ 2013-04-27 16:42 zhang1107 阅读(130) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4389View Code const int MM = 1111;typedef __int64 int64;#define debug puts("wrong")int N,M;int num[MM], cnt;int dp[10][82][82][82];int dfs(int le,int sum,int mod,int r,bool less) { //less前一位是否取到最大e=less?num[le]:9 if(sum>mod) return 0; if(le==-1) 阅读全文
posted @ 2013-04-27 15:06 zhang1107 阅读(185) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3507View Code const int MM = 555555;#define debug puts("wrong")#define mod 100000000typedef __int64 int64;int N,M;int val[MM],sum[MM], dp[MM];int head,tail,sq[MM];/***************\斜率优化DP dp[i]=min(dp[j]+sqr(sum[i]-sum[j])+M | 1<=j<i)对于队尾a b , 阅读全文
posted @ 2013-04-27 12:43 zhang1107 阅读(183) 评论(0) 推荐(0) 编辑