随笔分类 -  ACM-KMP

摘要:链接:https://ac.nowcoder.com/acm/contest/1099/C来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K Special Judge, 64bit IO Format: %lld 时间限制:C/C++ 阅读全文
posted @ 2019-10-09 21:18 StarHai 阅读(352) 评论(0) 推荐(0)
摘要:MUV LUV EXTRA Time Limit: 2000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 134 Accepted Submission(s): 49 Pr 阅读全文
posted @ 2019-09-28 19:57 StarHai 阅读(599) 评论(0) 推荐(0)
摘要:题意:让你把一个字符串反转,然后两个合并并去掉重复部分;就是求出末尾最长回文串; 题解:KMP;将原字符串反转,求出反转后的字符串的失配函数,然后与原字符串匹配; 参考代码: 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define clr 阅读全文
posted @ 2018-12-01 11:22 StarHai 阅读(386) 评论(0) 推荐(1)
摘要:拓展kmp是对KMP算法的扩展,它解决如下问题:定义母串S,和字串T,设S的长度为n,T的长度为m,求T与S的每一个后缀的最长公共前缀,也就是说,设extend数组,extend[i]表示T与S[i,n-1]的最长公共前缀,要求出所有extend[i](0=P如下图:... 阅读全文
posted @ 2018-06-07 00:49 StarHai 阅读(353) 评论(0) 推荐(1)
摘要:Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to brin... 阅读全文
posted @ 2018-04-13 23:18 StarHai 阅读(282) 评论(0) 推荐(1)
摘要:Number SequenceTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 34658 Accep... 阅读全文
posted @ 2018-03-30 17:19 StarHai 阅读(382) 评论(0) 推荐(0)
摘要:Power stringTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 54809 Accepted: 22806DescriptionGiven two strings a and b we def... 阅读全文
posted @ 2018-03-29 23:17 StarHai 阅读(298) 评论(0) 推荐(1)
摘要:DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names... 阅读全文
posted @ 2018-03-27 23:22 StarHai 阅读(375) 评论(0) 推荐(1)
摘要:void GetFail(char *P,int *Next){ int len = strlen(P); Next[0]= 0,Next[1]=0; for(int i=1;i<len;i++) { int j=Next[i]; while(j && P[... 阅读全文
posted @ 2018-03-25 13:36 StarHai 阅读(212) 评论(0) 推荐(0)