Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
73923 梁敖铭 最长回文子串 C++ Compile Error 0 MS 0 KB 429 2024-05-19 21:01:45

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ string s; int max=1; cin>>s; for(int i=0;i<s.length();i++){ int temp=0; for(int j=s.length()-1;j>i;j--){ if((i+temp<j)&&(s[i+temp]==s[j])){ temp++; } else{ temp=0; continue; } if((i+temp)==(j-1)&&(2*temp+1)>max){ max=(2*temp+1); } else if((i+temp)==j&&(2*temp)>max){ max=(2*temp); } } } cout<<ma


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int i=0;i