码迷,mamicode.com
首页 >  
搜索关键字:回文子串    ( 680个结果
Hiho-最长回文
先从标准输入读取一个整数N(N,代表我给你的字符串的个数,然后接下来的就是我要给你的那N个字符串(字符串长度而你要告诉我你的答案的话,只要将你计算出的最长回文子串的长度按照我给你的顺序依次输出到标准输出就可以了!你看这就是一个例子。” 提示一 提示二 提示三 提示四 样例输入 3 abababa aaaabaa acacdas 样例输出 7 5 3 #include...
分类:其他好文   时间:2015-04-03 17:31:50    阅读次数:141
DP VK Cup 2012 Qualification Round D. Palindrome pairs
题目地址:http://blog.csdn.net/shiyuankongbu/article/details/10004443 1 /* 2 题意:在i前面找回文子串,在i后面找回文子串相互配对,问有几对 3 DP:很巧妙的从i出发向两头扩展判断是否相同来找回文串 4 ...
分类:其他好文   时间:2015-04-01 21:30:11    阅读次数:119
求最长回文子串——Manacher算法
回文串包括奇数长的和偶数长的,一般求的时候都要分情况讨论,这个算法做了个简单的处理把奇偶情况统一了。算法的基本思路是这样的,把原串每个字符中间用一个串中没出现过的字符分隔开来(统一奇偶),用一个数组p[ i ]记录以 str[ i ] 为中间字符的回文串向右能匹配的长度。先看个例子原串: w a a...
分类:编程语言   时间:2015-04-01 15:08:14    阅读次数:136
hihocoder1032(最长回文子串manacher算法)
题目连接:点击打开链接 解题思路: manacher算法的模板题。 完整代码: #include #include #include #include #include #include #include #include using namespace std; typedef unsigned long long LL; const int MOD = ...
分类:编程语言   时间:2015-03-31 18:09:37    阅读次数:176
HDU3068(最长回文子串manacher算法)
题目连接:点击打开链接 解题思路: manacher算法模板题。 完整代码: #include #include #include #include #include #include #include #include using namespace std; typedef unsigned long long LL; const int MOD = i...
分类:编程语言   时间:2015-03-31 18:05:25    阅读次数:179
算法导论:回文子串(Manacher)算法 ,O(n)时间效率实现
问题描述: 输入一个字符串,求出其中最大的回文子串。子串的含义是:在原串中连续出现的字符串片段。回文的含义是:正着看和倒着看相同,如abba和yyxyy。 解析: 这里介绍O(n)回文子串(Manacher)算法 算法基本要点:首先用一个非常巧妙的方式,将所有可能的奇数/偶数长度的回文子串都转换成了奇数长度: 在每个字符的两边都插入一个特殊的符号。比如 abba 变成 #a#b#b#a#, aba变成 #a#b#a#。 为了进一步减少编码的复杂度,可以在字符串的开始加入另一个特殊字符,这样就不用...
分类:编程语言   时间:2015-03-29 15:08:35    阅读次数:305
最长回文子串
最长回文子串
分类:其他好文   时间:2015-03-29 13:29:54    阅读次数:112
HDU 3374 String Problem
最长回文子串,学习了一下manacher算法 #include #include char s[1000005]; int next[1000005]; int n; //i,j两个指针所指的位置可以保证已经是该指针之前的串里,最优的了 int min(int a,int b){ if(a<b) return a; return b; } int max(int a,int b...
分类:其他好文   时间:2015-03-28 13:04:30    阅读次数:135
HDU 3068 最长回文
学习了一下manacher回文 #include #include #include using namespace std; char s[110005]; char news[220005]; int p[220005]; int n; void manacher(){ n=strlen(s); int l=0; news[l++]='$'; news[l++]='#'; f...
分类:其他好文   时间:2015-03-28 13:02:04    阅读次数:126
hihoCoder #1032 最长回文子串
1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 void even_to_odd(string &init) { 9 init.insert(init.begin(),'(');1...
分类:其他好文   时间:2015-03-28 01:05:46    阅读次数:187
680条   上一页 1 ... 56 57 58 59 60 ... 68 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!