POJ - 1936 All in All解题报告
来源:互联网 发布:淘宝 处罚考试 编辑:程序博客网 时间:2024/05/15 00:44
题目大意:
注意:strlen是每一次都要重新遍历一遍数组
多组测试数据,每一组队两个字符串s和t。让你判断s是否为t的子序列。字符串长度100,000。这个时间复杂度肯定是O(n)了。
#include<iostream>#include<string.h>#include<stdio.h>#define N 100500using namespace std;char s[N]={0};char t[N]={0};void ceshi(){for(int i=0;i<strlen(s);i++){cout<<s[i];}for(int i=0;i<strlen(t);i++){cout<<t[i];}}int main(){while(scanf("%s %s",s,t)!=EOF){//ceshi();int x=strlen(s);int y=strlen(t);int i=0,j=0;//i指s,j指twhile(1){if(s[i]==t[j]){i++;}j++;if(i>=x){printf("Yes\n");break;}if(j>=y){printf("No\n");break;}}}}
注意:strlen是每一次都要重新遍历一遍数组
0 0
- POJ - 1936 All in All解题报告
- poj 1936 "all in all"
- poj 1936 All in All
- POJ 1936 All in All
- poj 1936 All in All
- POJ 1936 all in all
- POJ 1936 All in All
- POJ 1936 All in All
- POJ 1936 All in All
- POJ-1936-All in All
- poj 1936 all in all
- poj 1936 All in All
- POJ 1936 All in ALL
- poj 1936 All in All
- poj 1936 All in All
- POJ 1936 All in All
- All in All(poj 1936)
- poj 1936 All in All
- 计划太多,做得太少
- 剑指Offer系列-面试题18:树的子结构
- EventBus3的简单使用
- Hello Quartz (第三部分)
- 基于spark的精准推荐系统
- POJ - 1936 All in All解题报告
- 文人气质
- Android Instant APP
- 软件测试理论知识总结
- centos6.5安装部署nginx
- Hello Quartz (第四部分)
- hdu2063 基础二分图匹配,安利一篇好文章
- linux常用命令——4.网络命令
- Java POI 读取word文件