# wjyi

 博客园  :: 首页  :: 新随笔  :: 联系 ::  :: 管理
 我是一个傻叉 微笑脸  1 #include 2 #define inf 1000000000 3 #define ll long long 4 #define N 200005 5 #define mod 1000000007 6 using namespace std; 7 int read(){ 8 int x=0,f=1;char ch=getchar(); 9 while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 10 while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 11 return x*f; 12 } 13 struct CD{ 14 double x,y; 15 CD(double a=0,double b=0){x=a;y=b;} 16 friend CD operator + (CD n1,CD n2){return CD(n1.x+n2.x,n1.y+n2.y);} 17 friend CD operator - (CD n1,CD n2){return CD(n1.x-n2.x,n1.y-n2.y);} 18 friend CD operator * (CD n1,CD n2){return CD(n1.x*n2.x-n1.y*n2.y,n1.x*n2.y+n1.y*n2.x);} 19 }; 20 const double Pi=acos(-1.0); 21 int bit,n,nn,ans,m,mx,id,p[N<<1]; 22 char s[N],st[N<<1]; 23 CD a[N<<1],b[N<<1]; 24 void FFT(CD *a,int n,int type){ 25 for(int i=0,j=0;ii)swap(a[i],a[j]); 27 int k=n; 28 while(j&(k >>= 1))j&=~k; 29 j|=k; 30 } 31 for(int i=1;i<=bit;i++){ 32 CD w_n(cos(2*type*Pi/(1<i)p[i]=min(p[2*id-i],mx-i);else p[i]=0; 73 while(i-p[i]-1>0&&i+p[i]+1<=m&&st[i-p[i]-1]==st[i+p[i]+1])p[i]++; 74 if(i+p[i]>mx)mx=i+p[i],id=i; 75 ans=((ans-(p[i]+1)/2)%mod+mod)%mod; 76 } 77 printf("%d\n",ans); 78 return 0; 79 } View Code   posted on 2016-06-01 21:36  wjyi  阅读(188)  评论(0)  编辑  收藏  举报