当前位置: 首页 > news >正文

wordpress 点击文章上海seo网站优化

wordpress 点击文章,上海seo网站优化,台州seo全网营销,产品网站免费模板下载地址题解#xff1a; 将字符串A、B中的a和b分别以1和-1表示#xff0c;对字符串B进行反转。 将A和B看成多项式#xff0c;求卷积#xff0c;这样的话从结果区间的[lenB−1,lenA)[lenB−1,lenA)中的每一个点的值valval#xff0c;(lenB−val)/2(lenB−val)/2代表当前位置的字串…题解 将字符串A、B中的a和b分别以1和-1表示对字符串B进行反转。 将A和B看成多项式求卷积这样的话从结果区间的[lenB−1,lenA)[lenB−1,lenA)[lenB-1,lenA)中的每一个点的值valvalval(lenB−val)/2(lenB−val)/2(lenB-val)/2代表当前位置的字串与B串的距离然后对字串进行字符串hash去重就是答案。 #include iostream #include cstdio #include cmath #include algorithm #include cstring #include set using namespace std; double pi acos(-1.0); struct complex{double re,im;complex(double r 0.0,double i 0.0):re(r),im(i){};complex operator(complex com){return complex(recom.re,imcom.im);}complex operator-(complex com){return complex(re-com.re,im-com.im);}complex operator*(complex com){return complex(re*com.re-im*com.im,re*com.imim*com.re);} }; complex wn,wntmp; void rader(complex arr[],int n){int num n-1;for(int i 0;i n;i){int tn n1;while(num num tn) num ^ tn,tn 1;num | tn;if(num i) swap(arr[i],arr[num]);} } void FFT(complex cs[],int n,int f){rader(cs,n);for(int s 1;s n;s 1){wn complex(cos(f*2*pi/(s*2)),sin(f*2*pi/(s*2)));for(int offset 0;offset n;offset s1){wntmp complex(1.0,0.0);for(int i 0;i s;i){complex u cs[offseti],v cs[offsetis]*wntmp;cs[offseti] u v;cs[offsetis] u - v;wntmp wntmp * wn;}}}if(f -1)for(int i 0;i n;i)cs[i].re / n; } int K; const int maxn 600007; char A[maxn],B[maxn]; complex csA[maxn],csB[maxn]; unsigned long long fac 9973; unsigned long long pow(int x){unsigned long long ans 1,base fac;while(x){if(x 1)ans * base;base * base;x 1;}return ans; } int main(){int cas 0;while(cinK K ! -1){memset(csA,0,sizeof(csA)),memset(csB,0,sizeof(csB));cinAB;int lenA strlen(A),lenB strlen(B);for(int i 0;i lenB/2;i) swap(B[i],B[lenB-i-1]);int len 1;while(len lenA || len lenB) len 1;len 1;for(int i 0;i lenA;i) csA[i].re A[i] a?1:-1;FFT(csA,len,1);for(int i 0;i lenB;i) csB[i].re B[i] a?1:-1;FFT(csB,len,1);for(int i 0;i len;i) csA[i] csA[i]*csB[i];FFT(csA,len,-1);setunsigned long long st;unsigned long long hash 0,base pow(lenB-1);for(int i 0;i lenB;i) hash hash*fac (A[i] a);long long ans 0; for(int i lenB-1;i lenA;i){int dis (lenB - int(csA[i].re100000.5) 100000)/2;if(dis K) st.insert(hash),ans;hash (hash - base * (A[i-lenB1] a))*fac(A[i1] a);}printf(Case %d: %d\n,cas,st.size());}return 0; }
http://www.yutouwan.com/news/429679/

相关文章:

  • 怎样制作网站建设方案网站建设的公司太多了
  • 网站搭建详细步骤网站的首页面设计
  • 效果图网站有哪些怎么用一个主机做多个网站
  • 网站建设销售开场白用divid做网站代码
  • 网站内容建设的核心和根本是编程教学
  • 网站制作与管理技术标准实训教程wordpress andriod
  • 制作自己的网站多少钱外贸seo是什么意思
  • 宁海企业网站建设网站建设前端学什么语言
  • 网站建设的闪光点外网门户网站建设方案
  • wordpress简约下载站模板网站 301
  • 长春网站排名优化价格在线看视频网站怎么做
  • 灵武市建设银行网站做网站建
  • 都江堰城乡建设局网站wordpress登录不了
  • wordpress小工具文件seo网络推广机构
  • 那些网站做网批wordpress单页淘宝客
  • 电子商务网站的建设包含哪些流程图网站建设推广需要多少钱
  • 尉氏做网站网站降权如何百度申诉
  • seo优化网站推广专员招聘wordpress上传文件大小
  • 如何做登陆界面的网站网站建设销售员工作内容
  • asp 网站源码怎么看网站空间多大
  • 增加网站访客设计国外网站有哪些
  • 来客网站建设布吉做棋牌网站建设找哪家效益快
  • 响应式模板网站模板树状结构的网站
  • 网站对联代码divwordpress孤单链接设置
  • 自助建站网站平台阿里云域名注册优惠口令
  • 途牛企业网站建设方案docker搭建wordpress
  • 申请一个网站需要多少钱wordpress 劣势
  • 安徽省住房城乡建设部网站甘肃政务服务网
  • 网站推广在哪好外贸温州网页设计公司哪家好
  • 罗湖网站建设 信科网络wordpress 调查表 图片