摘要: 模板】KMP字符串匹配 从暴力说起 KMP字符串匹配用于两个字符串中,是否一个字符串是另一个的子串 我们称其中两个串一个为S(长度为n),一个为P(长度为m),问是否P为S的字串 这种题暴力的想法很容易想到但时间复杂度为\(O(nm)\) 遇到KMP 其实KMP也就只是在暴力的想法上进行了优化,不过 阅读全文
posted @ 2021-08-29 17:26 归游 阅读(82) 评论(0) 推荐(0)
摘要: ##区间选数 #include<cstdio> #include<cstring> #include<iostream> #include<ctime> #include<cstdlib> using namespace std; int n,k; int t; int main(){ ios::s 阅读全文
posted @ 2021-08-29 17:26 归游 阅读(88) 评论(0) 推荐(0)