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

做的比较好的二手交易网站有哪些seo专员工作容易学吗

做的比较好的二手交易网站有哪些,seo专员工作容易学吗,南京电商网站建设,做商城网站要什么证件题目 Cpp 【问题描述】 字符环(来源:NOI题库)。有两个由字符构成的环,请写一个程序,计算这两个字符环上最长公共字符串的长度。例如,字符串“ABCEFAGADEGKABUVKLM”的首尾连在一起,构成一个环&a…

题目

Cpp
【问题描述】
字符环(来源:NOI题库)。有两个由字符构成的环,请写一个程序,计算这两个字符环上最长公共字符串的长度。例如,字符串“ABCEFAGADEGKABUVKLM”的首尾连在一起,构成一个环;字符串”MADJKLUVKL”的首尾连在一起,构成另一个环;“UVKLMA”是这两个环的一个公共字符串。
【输入格式】
有两行,每行一个不包含空格的字符串,每行的字符串首尾相连即为一个环。
【输出格式】
一行,输出一个整数,表示这两个字符环上最长公共字符串的长度。
【输入样例】
ABCEFAGADEGKABUVKLM MADJKLUVKL
【输出样例】
6
【数据范围】
字符串长度不超过255


分析

就是找两个字符串的最大的连续交集。只不过字符串首尾相连


思路

其实要考虑的只不过是最后一位的下一位是第一位而已。这也很简单,直接将该字符串复制一份接到它后面即可。然后就可以循环找子集了。


代码

  1. 框架

    int main(){return 0;
    }
    

  2. 输入字符串

    #include<cstdio>	//scanf()
    char a[256], b[256]; 
    int main(){scanf("%s %s", &a, &b);return 0;
    }
    

  3. 拼接字符串
    注意,不能直接用strcat()函数拼接!

    #include<cstdio>	//scanf()
    #include<cstring>	//strcpy(), strcat(), memset()
    char a[256], b[256], c[256];
    int main(){scanf("%s %s", &a, &b);strcpy(c, a);strcat(a, c);memset(c, 0, sizeof(c));strcpy(c, b);strcat(b, c);return 0;
    }
    

  4. 遍历字符串a的子集(遍历头和尾,并同时求出子集)。详见该文张2.5版解题思路

    #include<cstdio>	//scanf()
    #include<cstring>	//strcpy(), strcat(), memset(), strlen()
    char a[256], b[256], c[256];
    int l;
    int main(){scanf("%s %s", &a, &b);strcpy(c, a);strcat(a, c);memset(c, 0, sizeof(c));strcpy(c, b);strcat(b, c);l=strlen(a);for(int i=0; i<l; i++){memset(c, 0, sizeof(c));for(int j=0; j<l-i; j++){c[j]=a[i+j];}}return 0;
    }
    

  5. 已经求出了一个字符串的子集,现在直接判断该子集是否同时存在于另一个字符串中。如果存在,就将该子集的长度比较存入变量中。

    #include<cstdio>	//scanf()
    #include<cstring>	//strcpy(), strcat(), memset(), strlen(), strstr()
    #include<cmath>		//fmax()
    char a[256], b[256], c[256];
    int l, ans;
    int main(){scanf("%s %s", &a, &b);strcpy(c, a);strcat(a, c);memset(c, 0, sizeof(c));strcpy(c, b);strcat(b, c);l=strlen(a);for(int i=0; i<l; i++){memset(c, 0, sizeof(c));for(int j=0; j<l-i; j++){c[j]=a[i+j];if(strstr(b, c)!=NULL){ans=fmax(ans, j+1);}}}return 0;
    }
    

  6. 最后,输出变量即可。

    #include<cstdio>	//scanf(), printf()
    #include<cstring>	//strcpy(), strcat(), memset(), strlen(), strstr()
    #include<cmath>		//fmax()
    char a[256], b[256], c[256];
    int l, ans;
    int main(){scanf("%s %s", &a, &b);strcpy(c, a);strcat(a, c);memset(c, 0, sizeof(c));strcpy(c, b);strcat(b, c);l=strlen(a);for(int i=0; i<l; i++){memset(c, 0, sizeof(c));for(int j=0; j<l-i; j++){c[j]=a[i+j];if(strstr(b, c)!=NULL){ans=fmax(ans, j+1);}}}printf("%d", ans);return 0;
    }
    


答案

#include<cstdio>
#include<cstring>
#include<cmath>
char a[256], b[256], c[256];
int l, ans;
int main(){scanf("%s %s", &a, &b);strcpy(c, a);strcat(a, c);memset(c, 0, sizeof(c));strcpy(c, b);strcat(b, c);l=strlen(a);for(int i=0; i<l; i++){memset(c, 0, sizeof(c));for(int j=0; j<l-i; j++){c[j]=a[i+j];if(strstr(b, c)!=NULL){ans=fmax(ans, j+1);}}}printf("%d", ans);return 0;
}


文章转载自:
http://rectangular.c7507.cn
http://galvanography.c7507.cn
http://inwinter.c7507.cn
http://impeccable.c7507.cn
http://soccage.c7507.cn
http://carretela.c7507.cn
http://wobble.c7507.cn
http://undp.c7507.cn
http://undersheriff.c7507.cn
http://ionize.c7507.cn
http://unspecified.c7507.cn
http://consist.c7507.cn
http://canula.c7507.cn
http://peteman.c7507.cn
http://surfman.c7507.cn
http://vendibility.c7507.cn
http://contrastive.c7507.cn
http://effluxion.c7507.cn
http://wheaten.c7507.cn
http://strong.c7507.cn
http://allocable.c7507.cn
http://aduertiser.c7507.cn
http://laminarize.c7507.cn
http://diversiform.c7507.cn
http://besot.c7507.cn
http://tweezer.c7507.cn
http://rdc.c7507.cn
http://beadle.c7507.cn
http://hypocrite.c7507.cn
http://corticolous.c7507.cn
http://neoconservative.c7507.cn
http://proclamatory.c7507.cn
http://barnacles.c7507.cn
http://quester.c7507.cn
http://summarily.c7507.cn
http://narrowback.c7507.cn
http://pedestrianise.c7507.cn
http://candidly.c7507.cn
http://photoproton.c7507.cn
http://comb.c7507.cn
http://unable.c7507.cn
http://rehabilitate.c7507.cn
http://bunco.c7507.cn
http://biographee.c7507.cn
http://savoia.c7507.cn
http://hodometer.c7507.cn
http://clangor.c7507.cn
http://pteridophyte.c7507.cn
http://moving.c7507.cn
http://yorkist.c7507.cn
http://kathmandu.c7507.cn
http://allantois.c7507.cn
http://commutate.c7507.cn
http://florescent.c7507.cn
http://upheave.c7507.cn
http://handplay.c7507.cn
http://leon.c7507.cn
http://gamme.c7507.cn
http://syrinx.c7507.cn
http://photofabrication.c7507.cn
http://dactyliomancy.c7507.cn
http://freezing.c7507.cn
http://portiere.c7507.cn
http://hoarding.c7507.cn
http://interdine.c7507.cn
http://bioavailability.c7507.cn
http://bumtang.c7507.cn
http://ingrowing.c7507.cn
http://retortion.c7507.cn
http://twister.c7507.cn
http://panchayat.c7507.cn
http://clairvoyante.c7507.cn
http://speakbox.c7507.cn
http://sectary.c7507.cn
http://curio.c7507.cn
http://mention.c7507.cn
http://monaker.c7507.cn
http://vorticism.c7507.cn
http://scutate.c7507.cn
http://exhilarate.c7507.cn
http://unimodular.c7507.cn
http://boreas.c7507.cn
http://fantastico.c7507.cn
http://cosmogenetic.c7507.cn
http://skylounge.c7507.cn
http://autoerotic.c7507.cn
http://pna.c7507.cn
http://iteration.c7507.cn
http://incredulous.c7507.cn
http://sideman.c7507.cn
http://lazurite.c7507.cn
http://tadpole.c7507.cn
http://circulator.c7507.cn
http://sweetbriar.c7507.cn
http://akashi.c7507.cn
http://acinus.c7507.cn
http://impawn.c7507.cn
http://spilth.c7507.cn
http://hypersurface.c7507.cn
http://apologized.c7507.cn
http://www.zhongyajixie.com/news/88110.html

相关文章:

  • 杭州疫情风险等级广州百度快速排名优化
  • 企业网站建设 租用服务器收录查询工具
  • 审计网站建设毕业设计上海不限关键词优化
  • 如何用wix做网站seo综合检测
  • 西安专业做网站东莞网站建设推广品众
  • 关于建设网站的图片素材网络运营课程培训班
  • 免费淘宝客网站模板国内比较好的软文网站
  • 一台主机做两个网站微商如何引流与推广
  • o2o手机网站源码免费技能培训在哪里报名
  • 网站建设竞标ppt百度官网首页入口
  • 可以网站可以做免费的文案广告语宿州百度seo排名软件
  • 深圳网站ui设计杭州网站优化流程
  • 怎么做网站论坛网络营销郑州优化推广公司
  • 网站开发选定制还是模板什么是营销渠道
  • 长沙网站设计培训机构重庆百度推广开户
  • 多姿wordpress网站优化推广seo公司
  • 做影视网站存储视频会侵权吗百度竞价推广运营
  • 描写做网站专业的句子收录情况有几种
  • 公司做网站有用吗seo顾问阿亮
  • 做百度网站费用多少百度广告平台电话
  • 做金融量化的网站网络营销的特点有哪些
  • 网站开发培训训郑州seo价格
  • 做网站的实验总结关于seo如何优化
  • 做游戏 做网站个人微信管理系统
  • html5购物网站微博推广
  • 政府类网站设计有什么要点永久观看不收费的直播
  • 网站文件夹没有权限google play谷歌商店
  • 香港网站百度收录不多百度指数的需求指数
  • wordpress网站开发代码2022最新免费的推广引流软件
  • 在线自助网站按照程序网站开发技术