码迷,mamicode.com
首页 >  
搜索关键字:最长回文    ( 742个结果
最长回文串
样例输入:Confuciiuss say:Madam,I'm Adam;样例输出:Madam,I'm Adam这个题我们首先要解决三个问题一个是大小写的问题一个是把符号忽略的问题 一个是输入字符串问题首先是输入字符串问题 我推荐使用fgets(buf,sizeof,stdin),这个输入关键字不会使...
分类:其他好文   时间:2014-11-26 22:12:06    阅读次数:270
hdu 4745 Two Rabbits 最长回文子序列
?? Description Long long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny afternoon, they planned to play a game with some stones. There were n stones on the ground and the...
分类:其他好文   时间:2014-11-26 11:25:50    阅读次数:194
[manacher] hdu 3294 Girls' research
题意: 给一个字符x代表真实的a 然后输出的时候转换 然后就是求最长回文子串的串是什么 长度要大于1 思路: 就是裸的manacher,弄清楚下标的转换关系就好了 代码: #include"cstdlib" #include"cstdio" #include"cstring" #include"cmath" #include"queue" #include"algorithm" #in...
分类:其他好文   时间:2014-11-17 12:26:57    阅读次数:152
1112个人赛,最长回文串常见算法讨论
ps.此贴大部分文字与代码来自网上,我只是取长补短整理了下S=“c a b a” 那么 S' = “a b a c”, 这样的情况下 S和 S‘的最长公共子串是aba。没有错误。 但是当 S=“abacdfgdcaba”, 那么S’ = “abacdgfdcaba”。 这样S和S‘的最长公共子串是....
分类:编程语言   时间:2014-11-13 00:16:35    阅读次数:350
最长回文串(manacher算法)
1 const int LEN=110005; 2 const int N=LEN*2; 3 int p[N]; 4 char str[LEN], tmp[N]; 5 //p[i]表示以str[i]为中心的回文往右延伸的 最长长度 6 void manacher(char* str, int* p....
分类:编程语言   时间:2014-11-12 21:00:49    阅读次数:241
Palindrome(最长回文串manacher算法)O(n)
PalindromeTime Limit:15000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionAndy the smart computer science student was attend...
分类:编程语言   时间:2014-11-12 21:00:46    阅读次数:231
hdu 3068 最长回文子串 马拉车模板
前几天用后缀数组写过一次这题,毫无疑问很感人的TLE了-_-||今天偶然发现了马拉车模板,O(N)时间就搞定reference:http://acm.uestc.edu.cn/bbs/read.php?tid=3258 1 #include 2 #include 3 #include 4 us...
分类:其他好文   时间:2014-11-02 20:57:43    阅读次数:151
uva11404
这题说的是给了一个长度为n的字符串(1000)求最长回文子序列,并输出当str[i]==ste[j]时dp[i][j]=dp[i+1][i-1]+2 否则 dp[i][j]=Max(dp[j+1][i],dp[j][i-1]) 要强调一下这uva真是强大 每个后面都加一个string都不爆内存太厉害...
分类:其他好文   时间:2014-10-27 19:00:09    阅读次数:188
hdu3068 最长回文串
最长回文串...
分类:其他好文   时间:2014-10-26 17:03:10    阅读次数:145
【LeetCode】Longest Palindromic Substring 解题报告
DP、KMP什么的都太高大上了,自己想了个朴素的遍历方法。 【题目】 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 longest palin...
分类:其他好文   时间:2014-10-26 15:37:32    阅读次数:249
742条   上一页 1 ... 66 67 68 69 70 ... 75 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!