icontofig | 发布于 2019-07-21 20:34:56 | 阅读量 375 | KMP
发布于 2019-07-21 20:34:56 | KMP
DescriptionMr. 'Jotishi' is a superstitious man. Before doing anything he usually draws some strange figures, and decides what to do next. One day he declared that the names that contain a string S as substring is unlucky. For example, let S be 'ab', then 'abc', 'cabe', 'pqqab', 'ab' etc are unlucky
继续阅读
icontofig | 发布于 2019-07-21 20:14:23 | 阅读量 335 | KMP
发布于 2019-07-21 20:14:23 | KMP
DescriptionA string is said to be a palindrome if it remains same when read backwards. So, 'abba', 'madam' both are palindromes, but 'adam' is not. Now you are given a non-empty string S, containing only lowercase English letters. The given string may or may not be palindrome. Your task is to make i
继续阅读
icontofig | 发布于 2019-07-20 21:56:59 | 阅读量 312 | KMP
发布于 2019-07-20 21:56:59 | KMP
HDU 3336 Count the string KMP(瞎搞)
题目大意求给定的字符串所有前缀在字符串中出现次数的总和mod10007的值 题解这题的结论是这样的:求出next数组,然后从后向前,依次累加…… 算了我也说不明白,还是给个代码合适。。。。 for(int i = 1;i <= n;++i){ a[i] = 1; } for(int i = n;i >= 1;--i)     a[nxt[i]] += a[i];就是这样的一个结论,然后O(n)就能求出所
继续阅读
icontofig | 发布于 2019-04-05 22:47:29 | 阅读量 297 | 字符串 KMP
发布于 2019-04-05 22:47:29 | 字符串 KMP
    不解释,就是KMP模板题……给出个人常用KMP模板QAQ #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <string> #include <cstring> #include <cmath> using namespace std; string s1; s
继续阅读