Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3385 莫业祁 31回文字符串II C++ Compile Error 0 MS 0 KB 508 2024-06-01 19:00:00

Tests(0/0):


Code:

# include<cstring> using namespace std; string s1; bool fun(int l,int r){ int size=r-l+1; for(int i=0;i<size/2;i++){ if(s1[l+i]!=s1[r-i])return false; } return true; } int main(){ cin>>s1; int size=s1.size(); for(int i=0;i<=size-1;i++){ for(int j=size-1;j>i+1;j--){ if(fun(i,j)==true){ cout<<"Yes"<<endl; return 0; } } } cout<<"No"<<endl; return 0; }


Run Info:

Main.cc:3:1: error: 'string' does not name a type
 string s1;
 ^
Main.cc: In function 'bool fun(int, int)':
Main.cc:7:12: error: 's1' was not declared in this scope
         if(s1[l+i]!=s1[r-i])return false;
            ^
Main.cc: In function 'int main()':
Main.cc:12:5: error: 'cin' was not declared in this scope
     cin>>s1;
     ^
Main.cc:12:10: error: 's1' was not declared in this scope
     cin>>s1;
          ^
Main.cc:17:17: error: 'cout' was not declared in this scope
                 cout<"Yes"<<endl;
                 ^
Main.cc:17:30: error: 'endl' was not declared in this scope
                 cout<<"Yes"<<endl;
                              ^
Main.cc:22:5: error: 'cout' was not declared in this scope
     cout<<"No"<<endl;
     ^
Main.cc:22:17: error: 'endl' was not declared in this scope
     cout<<"No"<<endl;
                 ^