在介绍算法之前,首先介绍一下什么是回文串,所谓回文串,简单来说就是正着读和反着读都是一样的字符串,比如abba,noon等等,一个字符串的最长回文子串即为这个字符串的子串中,是回文串的最长的那个。计 算字符串的最长回文字串最简单的算法就是枚举该字符串的每一个子串,并且判断这个子串是否为回文串,这个算...
分类:
编程语言 时间:
2015-10-29 19:56:52
阅读次数:
247
最长回文Time Limit: 2000msMemory Limit: 32768KBThis problem will be judged onHDU. Original ID:306864-bit integer IO format:%I64d Java class name:Main给出一个只...
分类:
其他好文 时间:
2015-10-27 15:10:28
阅读次数:
189
HOT~ 杭电2015级新生如何加入ACM集训队? 最长回文Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12244Accepted Submis...
分类:
其他好文 时间:
2015-10-25 17:51:56
阅读次数:
236
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-10-22 12:04:38
阅读次数:
148
#include #include #include #include #include #include #include using namespace std;int p[maxn];char s[maxn];void manacher(char *s){//时间复杂度O(n) int ...
分类:
编程语言 时间:
2015-10-13 10:24:48
阅读次数:
144
Description:给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input:输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开...
分类:
编程语言 时间:
2015-10-12 10:27:14
阅读次数:
143
主要学习自:http://articles.leetcode.com/2011/11/longest-palindromic-substring-part-ii.html问题描述:回文字符串就是左右对称的字符串,如:"abba",而最长回文子串则是字符串长度最长的回文子字符串,如"abbaca"的最...
分类:
编程语言 时间:
2015-10-11 17:52:19
阅读次数:
215
题目:输入字符串中对称的子字符串的最大长度。比如输入字符串“roorle”,由于该字符串里最长的对称子字符串是“roor”,因此输出4.思路:1、求字符串”roorle“和反序”elroor“的最长公共子串2、最长回文子串代码:1、最长公共子串#includeusing namespace std;...
分类:
编程语言 时间:
2015-10-09 21:14:37
阅读次数:
291
题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo...
分类:
其他好文 时间:
2015-10-06 22:12:48
阅读次数:
479
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3294给出一个字符串和加密的字符规律例如 c abcbac代表把串中的c改成a,d改成b... b改成z,a改成y...即上串是yzazy,然后求出它的最长回文子串, 并记录子串的开始下标和结束下标就行了...
分类:
其他好文 时间:
2015-10-02 11:20:08
阅读次数:
143