题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3065模板题,没什么好说的。。。#include#include#include#includeusing namespace std;const int N = 2e6+10;int a[1100];c... Read More
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2222一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过;本题就是最基础的模板;在此之前需要理解kmp和字典树(trie);Trie树有3个基本性质:(1)根... Read More
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4763题意就是求s串中满足EAEBE格式的E的最大长度;我们可以枚举前缀和后缀的所有匹配(k)看是否在s[k,len-k]中;如果不在它中间那么就让k=Next[k],刚开始想的是k--;但是这样循环次数... Read More
题目链接:http://poj.org/problem?id=3974 和hdu上的最长回文题一样,manacher的模板题 #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; const int Read More