摘要: hdu 3336题意:输入一个字符串求每个前缀在串中出现的次数和sol:只要稍微理解下next 数组的含义就知道只要把每个有意义的next值得个数加起来即可PS:网上有dp解法orz,dp[i]表示以i为前缀串结尾的前缀串的总和,方程很容易写出//字符串上KMP(水)//从前向后扫,失配函数的位置就... 阅读全文
posted @ 2014-02-06 22:15 acvc 阅读(1605) 评论(0) 推荐(0) 编辑
摘要: It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example:s: "abab"The prefixes are: "a", "ab", "aba", "abab"For each 阅读全文
posted @ 2014-02-06 14:17 acvc 阅读(204) 评论(0) 推荐(0) 编辑