码迷,mamicode.com
首页 >  
搜索关键字:回文子串    ( 680个结果
hdu 5340 Manachers + 枚举
题意:给你一个字符串问能否拆分为三个回文字符串?能就输出yes,否则输出no。知识补充:最长回文子串算法(Manacher算法):求解最长回文子串的线性时间复杂度算法,主要是通过中心扩展的方法极大地避免了重复计算。实现如下: 为了避免对字符串奇偶数的讨论,先对字符串做预处理如下: 规则为在字符间和两边插入'#'字符,为了避免越界处理,最两边插入'^'和'$'字符。 原本字符串为:asd 预处理后为:...
分类:其他好文   时间:2015-08-04 13:37:34    阅读次数:121
Manacher 算法(hdu 3068 && hdu 3294)
今天打算补前晚 BC 的第二题,发现要用到能在 O(n) 时间求最大回文子串长度的Manacher 算法,第一次听,于是便去百度了下,看了大半天,总算能看懂了其思想,至于他给出的代码模板我没能完全看懂,只好自己试着实现,发现理解了思想后还是能实现出来的,用自己的风格去写更好理解,先附上讲解Man.....
分类:编程语言   时间:2015-08-03 20:49:43    阅读次数:142
算法学习笔记——判断最小回文子串
利用C语言实现的最长回文子串算法 1 # include 2 # include 3 # include 4 5 # define MAXN 5000 + 10 6 char buf[MAXN], s[MAXN]; //buf输入字符串, s去掉标点空格并转为大写的预处理字符串 7 int p[.....
分类:编程语言   时间:2015-08-02 16:25:27    阅读次数:136
hdu 5340 最长回文子串变形
http://acm.hdu.edu.cn/showproblem.php?pid=5340 Problem Description Can we divided a given string S into three nonempty palindromes?   Input First line contains a single integer T≤...
分类:其他好文   时间:2015-08-02 15:16:06    阅读次数:153
最长回文子串
len j+F[j]/2 最大的;#include #include #include #include #include using namespace std;const int maxn = 1000005*2;char s[maxn];char str[maxn];int ans;int ....
分类:其他好文   时间:2015-08-02 00:48:39    阅读次数:194
Manacher模板
Manacher模板求最长回文子串。#include#include#include#include#include#include#include#include#include#include#include#include#include#define ll long long#define ...
分类:其他好文   时间:2015-07-27 14:53:19    阅读次数:128
hihocoder1302 最长回文子串
hihocoder1302 最长回文子串先贴代码所有的上面的提示已经交代的好清楚了……#include #include #include #include #include #include #include #include #include #include #include #include...
分类:其他好文   时间:2015-07-26 23:53:49    阅读次数:124
#1032 : 最长回文子串
时间限制:1000ms 单点时限:1000ms 内存限制:64MB 描述 小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一连串的字符串,于是小Hi就向小Ho提出了那个经典的问题:“小Ho,你能不能分别在这些字符串中找到它们每一个的最长回文子串呢?”小Ho奇怪的问道:“什么叫做最长回文子串呢?”...
分类:其他好文   时间:2015-07-20 11:00:57    阅读次数:136
OJ模板库
最近刷了好几次的oj,好受伤好多都是类似的题目。最长回文子串string preprocess(string &str) { string afterProcessStr="#"; for(int i=0;i<str.size();++i) { afterProcessStr += str.substr(i, 1)+"#"; } return...
分类:其他好文   时间:2015-07-20 10:57:58    阅读次数:111
codeforces 557 E Ann and Half-Palindrome
题意是要求出一个串的第k大的半回文子串 半回文串的定义是:若一个串其实位置为1,那么当所有奇数位i,且i 那么这个串就是半回文串。 作法就是,把这个串的所有半回文子串建成一个字典树,然后查第k大就好了 #include #include #include #include #include #include #include #include #include #i...
分类:其他好文   时间:2015-07-19 10:09:46    阅读次数:125
680条   上一页 1 ... 50 51 52 53 54 ... 68 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!