PAT 1040 Longest Symmetric String】的更多相关文章

1040 Longest Symmetric String (25)(25 分) Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given "Is PAT&TAP symmetric?", the longest symmetric sub-string is "s PAT&TAP s",…
#include <cstdio> #include <cstdlib> using namespace std; ]; ]; int syslen(char str[], int start) { ; ; ; && str[q] != '\0' && str[p] == str[q]) { p--, q++; len += ; } return len; } int main() { scanf("%[^\n]s", line)…
1040 Longest Symmetric String (25 分)   Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you must output 11.…
题目链接:http://www.patest.cn/contests/pat-a-practise/1040 题目: 1040. Longest Symmetric String (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a string, you are supposed to output the length of the longest symmetric sub-stri…
1040 Longest Symmetric String (25 分) Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you must output 11. In…
https://pintia.cn/problem-sets/994805342720868352/problems/994805446102073344 Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s P…
Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you must output 11. Input Specification: Each input file co…
Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you must output 11. Input Specification: Each input file co…
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789177.html特别不喜欢那些随便转载别人的原创文章又不给出链接的所以不准偷偷复制博主的博客噢~~ 给出一个字符串,让你找出其中最长的回文子串的长度因为长度最多1000,其实暴力枚举也可以对于第i个字符,往前.往右找,统计能够达到的最大回文长度,for一遍即可然而如果对应大数据就不行了,所以这里还是用了Manacher算法 O(n) 求最长回文子串不会的还…
暴力. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ]; int ans,len,sum; void check(int a,int b) { if(s[a]!=s[b]) return; ; ; ,right=b+; ||right>=len||s[left]!=s[right])) left--,right++,sum=sum+; ans=max(ans…