
字符串
zz_ylolita
这个作者很懒,什么都没留下…
展开
-
vijosP1005超长数字串
描述 他最喜欢的是数字的无穷序列,结果是把所有的自然数按升序排列。这个序列开始是: 1234567891011121314... 我们叫序列 S。然后 S[1] = 1, S[2] = 2, ... , S[10] = 1, S[11] = 0, ... , 以此类推。 George 现有一个数字系列 A ,他想知道在S中最早出现的位置。帮助他解决这个难题。 输入格式 输入原创 2014-12-08 23:45:56 · 3211 阅读 · 0 评论 -
Manacher算法
http://blog.youkuaiyun.com/ggggiqnypgjg/article/details/6645824/ 原文说的很清楚,Manacher算法就是O(n)来求一个字符串S的最长回文串的。 hdu3068 #include #include #include #include #include //max min函数包含在这个里面。。? using namespace原创 2016-01-01 23:57:18 · 454 阅读 · 0 评论 -
poj3461—KMP裸题
题目大意:给出两个字符串p和s,求出p在s中出现的次数 #include #include #include #include using namespace std; char p[10010],s[1000010]; int next[10010]; int lenp,lens,ans,m; void getnext() { next[0]=-1; int j=-原创 2016-02-10 22:36:22 · 1037 阅读 · 0 评论 -
KMP算法
Matrix67教你KMP 详细介绍KMP的地方 练习: poj3461 题目大意:给出两个字符串p和s,求出p在s中出现的次数 #include #include #include #include using namespace std; char p[10010],s[1000010]; int next[10010]; int lenp,lens,ans,m; void原创 2016-02-10 21:23:40 · 370 阅读 · 0 评论 -
poj2406—KMP next数组的性质求最小周期
题目大意:给出一个字符串,求它最多有几个连续子串构成 分析:KMP求最小周期——结论:如果一个字符串有最小周期,那么最小周期为n-next[n] 考虑整个串,根据next数组的定义,前后匹配并且前缀和相等的最长的后缀之间没有交叉,那么相等的部分的长度为next[n],并且从左往右相等。 如果希望中间的也是有s[1..next[n]]的几个循环组成,那么整个串就以next[n]为最小周原创 2016-02-10 22:37:57 · 1605 阅读 · 0 评论 -
bzoj3670:NOI2014 动物园
#include #include #include #include using namespace std; #define L 1000010 #define P 1000000007 int n,m; char s[L]; int next[L],num1[L]; long long ans; void getnext() { int j=0;next[1]=0;原创 2016-02-11 01:13:07 · 778 阅读 · 0 评论