上一页 1 2 3 4 5 6 7 8 ··· 16 下一页

2017年4月1日

POJ 2001 Shortest Prefixes

摘要: 传送门:http://poj.org/problem?id=2001 解题思路: 简单的字典树 实现代码: 阅读全文

posted @ 2017-04-01 19:04 mkfoy 阅读(141) 评论(0) 推荐(0) 编辑

字典树模板

摘要: const int N=27; struct node{ int cnt; node* childs[N]; node(){ cnt=0; for(int i=0;ichilds[m]!=NULL){ current=current->childs[m]; ++(current->cnt);... 阅读全文

posted @ 2017-04-01 09:07 mkfoy 阅读(153) 评论(0) 推荐(0) 编辑

HDU 1251 统计难题

摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1251 解题思路: 一个简单的字典树问题。 实现代码: 阅读全文

posted @ 2017-04-01 09:06 mkfoy 阅读(87) 评论(0) 推荐(0) 编辑

2017年3月31日

kmp算法模板

摘要: //针对的是一个整数序列。void makeNext(const int P[],int next[],int m){ int q=0; memset(next,0,sizeof(next)); for(int i=1;i0&&P[q]!=P[i]) q=next[q-1]; if(P[q]==P[i]) q... 阅读全文

posted @ 2017-03-31 20:11 mkfoy 阅读(152) 评论(0) 推荐(0) 编辑

HDU 2087 剪花布条

摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2087 解题思路: 简单的kmp算法 实现代码: 阅读全文

posted @ 2017-03-31 18:22 mkfoy 阅读(151) 评论(0) 推荐(0) 编辑

HDU 1686 Oulipo

摘要: 传送门;http://acm.hdu.edu.cn/showproblem.php?pid=1686 解题思路:简单的kmp算法。 实现代码: 阅读全文

posted @ 2017-03-31 17:48 mkfoy 阅读(186) 评论(0) 推荐(0) 编辑

HDU 1771 Number Sequence

摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1711 解题思路:简单的KMP算法实现。 实现代码: 阅读全文

posted @ 2017-03-31 16:19 mkfoy 阅读(200) 评论(0) 推荐(0) 编辑

2017年3月29日

HDU 2859 Phalanx

摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2859 解题思路: 对于每个字符看该列以上和该行右侧的字符匹配量,如果匹配量大于右上角记录下来的矩阵大小,就是右上角的数值+1,否则就是这个匹配量。 实现代码: 下面的超时: 阅读全文

posted @ 2017-03-29 13:37 mkfoy 阅读(187) 评论(0) 推荐(0) 编辑

POJ 3616 Milking Time

摘要: 解题思路: dp[i]:选择第i个区间获得最大值1.只在第i个区间取奶 dp[i]=node[i].val;2.如果能在前面已经取奶的后面接着取奶 node[j].ed+R<=node[i].st 时dp[i]=dp[j]+node[i].val;dp[i]=max(dp[i],dp[j]+node 阅读全文

posted @ 2017-03-29 10:57 mkfoy 阅读(192) 评论(0) 推荐(0) 编辑

2017年3月28日

POJ 3666 Making the Grade

摘要: 传送门:http://poj.org/problem?id=3666 解题思路: dp[i][j]:代表第i个数以j结尾所花的代价。。那么dp[i][j]=fabs(a[i]-j)+min(dp[i-1][k])k<j; 实现代码: 阅读全文

posted @ 2017-03-28 20:55 mkfoy 阅读(193) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 16 下一页

导航