字符串
撒旦即可
研究CV的菜狗
展开
-
hdu2222(AC自动机模板)
解题思路:AC自动机模板题,没什么好说的。关于题目中一些要注意的问题详见代码注释,代码复杂度为O(n),n为字符串长度#include<cstdio>#include<cstring>#include<queue>using namespace std;const int MAXN=500009;struct node{ char c; i...原创 2019-02-25 17:41:55 · 99 阅读 · 0 评论 -
poj3690(哈希字符串匹配)
解题思路:这道题就是给定一个二维的矩阵(n*m),然后给几个小矩阵(p*q)去进行匹配。那我们就可以看成是一个p*q<2500的字符串匹配。所以可以用hash.接下来就是传统的hash字符串匹配了。kmp是肯定不行的,因为是多字符串匹配。题比较基础,代码以后再写吧,先占个坑。...原创 2019-02-25 21:04:12 · 304 阅读 · 0 评论 -
poj3581(后缀数组)
关于后缀数组详见这两篇博客,讲得很好:https://www.cnblogs.com/victorique/p/8480093.htmlhttps://www.cnblogs.com/shanchuan04/p/5324009.html最近有事,有时间补题原创 2019-02-26 10:13:48 · 122 阅读 · 0 评论 -
HDU3068(Manacher算法求最大回文串,模板)
基本原理详见我的代码注释和http://www.cnblogs.com/hate13/p/4348751.html#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<set>#include<vector>...原创 2019-03-01 20:30:26 · 95 阅读 · 0 评论 -
HDU5340(manacher回文串)
解题思路:其实就是求出包括字符串开头的回文串,求出包括结尾的回文串,然后对余下的中间部分进行判断。注意,三个回文串不能有任何一个是空串!#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;char s[400...原创 2019-03-01 22:20:45 · 221 阅读 · 0 评论 -
字符串函数总结
一.strncmp下面是 strncmp() 函数的声明。int strncmp(const char *str1, const char *str2, size_t n)参数str1-- 要进行比较的第一个字符串。 str2-- 要进行比较的第二个字符串。 n-- 要比较的最大字符数。返回值该函数返回值如下:如果返回值 < 0,则表示 str1 小于 ...原创 2019-08-26 00:18:26 · 196 阅读 · 0 评论