ZOJ Problem Set - 2744
Time Limit: 1 Second Memory Limit: 32768 KB
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from left to right as when the string is read from right to left.
Now give you a string S, you should count how many palindromes in any consecutive substring of S.
Input
There are several test cases in the input. Each case contains a non-empty string which has no more than 5000 characters.
Proceed to the end of file.
Output
A single line with the number of palindrome substrings for each case.
Sample Input
aba
aa
Sample Output
4
3
Author: LIU, Yaoting
Source: Zhejiang Provincial Programming Contest 2006
Submit Status
本文介绍了一种用于计算字符串中所有连续子串回文数量的算法,并提供了完整的C++实现代码。该算法通过动态规划的方法判断每个子串是否为回文,适用于多种编程竞赛场景。
1060

被折叠的 条评论
为什么被折叠?



