先贴代码
所有的上面的提示已经交代的好清楚了……
#include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <map> #include <queue> #include <stack> #include <set> #include <string> #include <climits> using namespace std; typedef long long ll; const double ESP = 10e-8; const int MOD = 1000000000+7; const int MAXN = 1000000+10; char Str[MAXN]; char str[MAXN<<1]; int f[MAXN<<1]; int main(){ // freopen("input.txt","r",stdin); // ios::sync_with_stdio(false); int t; scanf("%d",&t); while(t--){ scanf("%s",Str); int len = strlen(Str); int n = 0; str[n++] = '$'; str[n++] = '#'; for(int i = 0;i < len;i++){ str[n++] = Str[i]; str[n++] = '#'; } //f[i]真正的回文子串长度+1,也是当前回文串的一半长度+1 str[n] = '