一. KMP

1 找字符串x是否存在于y串中,或者存在了几次

HDU1711 Number Sequence

HDU1686 Oulipo

HDU2087 剪花布条

2.求多个字符串的最长公共子串

POJ3080 Blue Jeans

HDU1238 Substrings

3.next数组的应用

1) 求循环节

HDU3746 Cyclic Nacklace

HDU1358 Period

POJ2406 Power Strings

HDU3374 String Problem

2) 利用next数组的回退来求值:

HDU3336 Count the string

HDU4300 Clairewd’s message

FZU1901 Period II

HDU4763 Theme Section

4.即是前缀又是后缀

POJ2752 Seek the Name, Seek the Fame

HDU2594 Simpsons’ Hidden Talents

HDU4763 Theme Section

二.扩展KMP

1)求前缀、后缀是否为回文串

HDU3613 Best Reward

POJ3376 Finding Palindromes

三.Manacher算法

1)单纯的求最长回文串长度

51Nod 1089 最长回文子串 V2

HDU4513 吉哥系列故事

2)求出最长回文串的位置

HDU3294 Girls' research

HDU3613 Best Reward

四.最小最大表示法:

模板:

int getmin(char *s, int len, int type)  //当type为1时,为最小表示法;当type为-1时,为最大表示法
{
int i = , j = , k = ;
while(i<len && j<len && k<len)
{
int t = s[(i+k)%len]-s[(j+k)%len];
if (!t) k++;
else
{
//当t>0时,i~i+k的位置都不可能作为起始点,因为在j~j+k处有更优值。同理j。
if (type*t>) i += k+; //唯一不同的地方
else j += k+;
if (i==j) j++;
k = ;
}
}
return i<j?i:j;
/*
为什么要返回下标小的呢?
看循环条件,可知:当i、j、k其中一个等于len时,循环结束。
1) 当k==len时,表明在i处的表示等于在j处的表示。那么随便哪一个都行
2) 当k!=len时,即i或j其中一个等于len,那么等于len的那个下标其实已经溢出了。所以取小的那个
综上:return min(i, j);
*/
}

HDU2609 How many

51Nod 1282 时钟

HDU3374 String Problem

KMP 、扩展KMP、Manacher算法 总结的更多相关文章

  1. 字符串匹配—KMP 扩展KMP Manacher

    kuangbin字符串专题传送门--http://acm.hust.edu.cn/vjudge/contest/view.action?cid=70325#overview 算法模板: KMP: ; ...

  2. ACM之路(12)—— KMP & 扩展KMP & Manacher

    最近做完了kuangbin的一套关于kmp的题目(除了一道字典树的不会,因为还没学字典树所以先放放),做个总结.(kuangbin题目的链接:http://acm.hust.edu.cn/vjudge ...

  3. Kuangbin 带你飞 KMP扩展KMP Manacher

    首先是几份模版 KMP void kmp_pre(char x[],int m,int fail[]) { int i,j; j = fail[] = -; i = ; while (i < m ...

  4. 【string】KMP, 扩展KMP,trie,SA,ACAM,SAM,最小表示法

    [KMP] 学习KMP,我们先要知道KMP是干什么的. KMP?KMPLAYER?看**? 正如AC自动机,KMP为什么要叫KMP是因为它是由三个人共同研究得到的- .- 啊跑题了. KMP就是给出一 ...

  5. kmp&扩展kmp

    kmp: KMP的主要目的是求B是不是A的子串,以及若是,B在A中所有出现的位置 写的很详细的大佬的博客:http://www.matrix67.com/blog/archives/115 模板: / ...

  6. kuangbin专题十六 KMP&&扩展KMP HDU2609 How many (最小字符串表示法)

    Give you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell me How man ...

  7. hdu 4300 Clairewd’s message(kmp/扩展kmp)

    题意:真难懂.. 给出26个英文字母的加密表,明文中的'a'会转为加密表中的第一个字母,'b'转为第二个,...依次类推. 然后第二行是一个字符串(str1),形式是密文+明文,其中密文一定完整,而明 ...

  8. [kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher 题解报告

    来刷kuangbin字符串了,字符串处理在ACM中是很重要的,一般比赛都会都1——2道有关字符串处理的题目,而且不会很难的那种,大多数时候都是用到一些KMP的性质或者找规律. 点击标题可跳转至VJ比赛 ...

  9. kuangbin专题十六 KMP&&扩展KMP HDU3613 Best Reward(前缀和+manacher or ekmp)

    After an uphill battle, General Li won a great victory. Now the head of state decide to reward him w ...

  10. kuangbin专题十六 KMP&&扩展KMP HDU2328 Corporate Identity

    Beside other services, ACM helps companies to clearly state their “corporate identity”, which includ ...

随机推荐

  1. OpenJ_Bailian3375

    Farmer John has decided to reward his cows for their hard work by taking them on a tour of the big c ...

  2. SHUoj 神无月排位赛

    神无月排位赛 发布时间: 2017年7月8日 21:06   最后更新: 2017年7月8日 22:35   时间限制: 1000ms   内存限制: 128M 描述 <神无月>作为盛大游 ...

  3. Java 模板权重随机

    Template templates=...// 所有的模板 final int _weights=1000; // 所有的模板权重 Template _template=null; //随机一个权重 ...

  4. python多线程(二)

    原文:http://blog.sina.com.cn/s/blog_4b5039210100esc1.html 基础不必多讲,还是直接进入python. Python代码代码的执行由python虚拟机 ...

  5. Java修饰符关键字的顺序

    Java语言规范建议按以下顺序列出修饰符: 1. Annotations 2. public 3. protected 4. private 5. abstract 6. static 7. fina ...

  6. Swift标识符和keyword

    不论什么一种计算机语言都离不开标识符和keyword,下面我们将具体介绍Swift标识符和keyword. 标示符 标识符就是给变量.常量.方法.函数.枚举.结构体.类.协议等指定的名字.构成标识符的 ...

  7. ElasticSearch集群本机搭建

    ElasticSearch集群本机搭建 elasticsearch elasticsearch -Ehttp.port=8200 -Epath.data=node2 elasticsearch -Eh ...

  8. string 复制给char[] 即:c_str() 用法:

    语法: const char *c_str();c_str()函数返回一个指向正规C字符串的指针, 内容与本string串相同. 这是为了与c语言兼容,在c语言中没有string类型,故必须通过str ...

  9. 30 分钟编写一个 Flask 应用

    Flask 是一种很赞的Python web框架.它极小,简单,最棒的是它很容易学. 今天我来带你搭建你的第一个Flask web应用!和官方教程 一样,你将搭建你自己的微博客系统:Flaskr.和官 ...

  10. [WASM] Access WebAssembly Memory Directly from JavaScript

    While JavaScript has a garbage-collected heap, WebAssembly has a linear memory space. Nevertheless u ...