Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
136428 hjx455 统计回文子串 C++ Compile Error 0 MS 0 KB 484 2025-11-14 12:33:07

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; int main() { char s[5050]; int i,j,l; while (cin>>s) { l=strlen(s); l=4 int k=0; for (i=0;i<l;i++) { for (j=0;i-j>=0 and i+j<l;j++) //奇数aaaa { if (s[i-j]==s[i+j]) k++; else break; } if (s[i]==s[i+1]) for (j=0;i-j>=0 && i+1+j<l;j++) //偶数 { if (s[i-j]==s[i+1+j]) k++; else break; } } cout<<k<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:3: error: expected ';' before 'int'
   int k=0;
   ^
Main.cc:16:6: error: 'k' was not declared in this scope
      k++; 
      ^
Main.cc:24:7: error: 'k' was not declared in this scope
       k++;  
       ^
Main.cc:29:9: error: 'k' was not declared in this scope
   cout<