| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 136267 | hjx4 | 统计回文子串 | C++ | Time Limit Exceeded | 1000 MS | 268 KB | 798 | 2025-11-10 10:49:06 |
#include <bits/stdc++.h> using namespace std; int main() { int d,f,i,j,k,n,t,s,temp; string a; cin>>t; cin>>a; s=a.size(); f=0; j=a.size()-1; temp=1; while (f<a.size()/2) { if (a[f]==a[j]) { f++; j--; } else { temp=0; break; } } if (temp!=0 and a.size()>3) s++; d=f=j=0; while (j<a.size()-1) { k=j+1; temp=1; while (k<a.size()) { if (a[j]==a[k] and d<=1) { f++; k++; s++; if (d==1) d=2; } else if (f>0 or temp==0) { d=f=0; break; } else { k++; d++; temp=0; } } j++; } cout<<s<<endl; return 0; }