2013年11月16日

hdu3336 Count the string kmp+dp

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3336很容易想到用kmp这里是next数组的应用定义dp[i]表示以s[i]结尾的前缀的总数那么dp[i]=dp[next[i]]+1;代码: 1 #include 2 #include 3 const ... 阅读全文

posted @ 2013-11-16 17:26 GyyZyp 阅读(132) 评论(0) 推荐(0) 编辑

hdu4763 Theme Section(KMP)

摘要: 简单的next数组的应用先求出next[n],然后可以在1-next[n]之间枚举长度找出不和前缀和后缀重复的中间的最大长度即可代码: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define ma... 阅读全文

posted @ 2013-11-16 10:46 GyyZyp 阅读(155) 评论(0) 推荐(0) 编辑

导航