随笔分类 -  KMP

摘要:$\DeclareMathOperator{\fail}{fail}$ KMP 算法堪称经典中的经典,然而这么多年以来,我却未能完全理解这个算法。我对 KMP 算法掌握的程度,是知其原理,但写不出来。 今天打 CF,遇到一个 KMP 的题目,解法很好想,代码量也不大,我却未能在最后的 17 分钟内 阅读全文
posted @ 2019-03-09 12:30 Pat 阅读(298) 评论(0) 推荐(0)
摘要:传送门 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 14761 Accepted: 7407 Description The little cat is so famous, that many couples tramp o 阅读全文
posted @ 2015-10-29 22:04 Pat 阅读(263) 评论(0) 推荐(0)
摘要:Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 38908 Accepted: 16170 Description Given two strings a and b we define a*b to be their conca 阅读全文
posted @ 2015-10-29 21:19 Pat 阅读(189) 评论(0) 推荐(0)
摘要:KMP算法是基本的字符串匹配算法,但是代码实现上有一些细节容易错。这篇随笔将认真总结一下。 KMP算法的核心是: The KMP algorithm searches for occurrences of a "word" W within a main "text string" S by emp 阅读全文
posted @ 2015-10-29 19:45 Pat 阅读(477) 评论(0) 推荐(0)