Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
123619 吴诗涵 最长回文子串 C++ Compile Error 0 MS 0 KB 748 2025-07-06 19:36:09

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ string str; int maxLen=1; cin>>str; for(int j=0;i<str.size();i++){ int temp=0; for(int j=str.size()-1;j>i;j--){ if(i+temp<j&&str[i+temp]==str[j]){ temp++; } else{ temp=0; continue; } if((i+temp)==(j-1)&&(2*temp+1)>maxLen) maxLen=(2*temp+1); else if((i+temp)==j&&(2*temp)>maxLen) maxLen=(2*temp); } } cout<<maxLen<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:13: error: 'i' was not declared in this scope
 for(int j=0;i