Fork me on GitHub
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3336分析:求字符串中所有前缀的匹配次数,先求出next数组,从n->1开始枚举计数。/*Count the stringTime Limit: 2000/1000 MS (Java/Others) ... 阅读全文
posted @ 2015-03-18 17:02 I'm coding 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2594分析:判断是否在两串中存在子串,能作为s1的前缀 && s2的后缀。可以考虑将两串合并,然后直接利用next数组。合并后可能会出现的状况是,所求子串大于s1 || s2的长度,所以还要进行一次判断。... 阅读全文
posted @ 2015-03-18 07:58 I'm coding 阅读(259) 评论(0) 推荐(0) 编辑