http://acm.hdu.edu.cn/showproblem.php?pid=5371
Problem Description
Hotaru Ichijou recently is addicated to math problems. Now she is playing with N-sequence.
Let's define N-sequence, which is...
分类:
编程语言 时间:
2015-08-13 14:32:32
阅读次数:
128
d[i]表示前面i个字符划分成的最小回文串个数,那么转移i字符和之前的某个字符j构成回文串形成的新划分,所以要判断前面的字符j+1到i是不是回文串,可以用Manacher算法预处理出来。#include #include #include #includeusing namespace std;co...
分类:
其他好文 时间:
2015-08-13 14:07:59
阅读次数:
141
Hotaru's problemTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1765Accepted Submission(s): 635Pro...
分类:
其他好文 时间:
2015-08-13 12:03:06
阅读次数:
116
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=5371题意:
给出一个长度为n的串,要求找出一条最长连续子串。这个子串要满足:1:可以平均分成三段,2:第一段和第三段相等,3:第一段和第二段回文。求最大子串的长度。代码:#include
#include
#include
#include<s...
分类:
其他好文 时间:
2015-08-13 06:32:08
阅读次数:
121
算法原理:manacher算法:定义数组p[i]表示以i为中心的(包含i这个字符)回文串半径长将字符串s从前扫到后for(inti=0;imaxlen,则初始化p[i+k]=1;//本身是回文串然后p[i+k]左右延伸,即while(s[i+k+p[i+k]]==s[i+k-p[i+k]])++p[...
分类:
编程语言 时间:
2015-08-12 23:03:33
阅读次数:
135
HDU 5371 Hotaru's problem(manacher + 枚举啊)...
分类:
其他好文 时间:
2015-08-12 21:46:27
阅读次数:
108
http://acm.hdu.edu.cn/showproblem.php?pid=5371/*先用Manacher算法得出最长回文子串,然后用set维护ans的值对所有回文的长度进行排序, 那么之后的点如果覆盖了最接近的点那么那么点肯定是覆盖了当前点,用二分得到最近不大于u的距离S.upper_b...
分类:
其他好文 时间:
2015-08-12 21:36:40
阅读次数:
106
题意:给出一个字符串,要求出一个最长子串的长度,子串满足可以将其分成三部分,第一部分跟第二部分互为回文串,第三部分跟第一部分一样。
做法:
先用求回文串的Manacher算法,求出以第i个点和第i+1个点为中心的回文串长度,记录到数组c中 比如 10 9 8 8 9 10 10 9 8 我们通过运行Manacher求出第i个点和第i+1个点为中心的回文串长度 0 0 6 0 0 6 0...
分类:
其他好文 时间:
2015-08-12 19:38:37
阅读次数:
95
先用求回文串的Manacher算法,求出以第i个点和第i+1个点为中心的回文串长度,记录到数组c中 比如 10 9 8 8 9 10 10 9 8 我们通过运行Manacher求出第i个点和第i+1个点为中心的回文串长度 0 0 6 0 0 6 0 0 0
两个8为中心,10 9 8 8 9 10是个回文串,长度是6。 两个10为中心,8 9 10 10 9 8是个回文串,长度是6。
...
分类:
其他好文 时间:
2015-08-12 19:30:43
阅读次数:
80
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5371这道题用到了Manacher算法,首先简单介绍一下Manacher算法:---------------------------------------------------------------...
分类:
其他好文 时间:
2015-08-12 18:48:55
阅读次数:
138