All in All

题目链接:http://poj.org/problem?id=1936

题目大意:判断从字符串s2中能否找到子串s1。字符串长度为10W。

Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter

Sample Output

Yes
No
Yes
No

分析:这明明是模拟题,有人竟然把它归为动态规划,是要用LCS做吗

代码如下:

 # include<stdio.h>
# include<string.h>
# define MAX
char s1[MAX],s2[MAX];
int main(){
while(scanf("%s%s",s1,s2)!=EOF){
int len1 = strlen(s1);
int len2 = strlen(s2);
int i=;
int j=;
while(){
if(i==len1){
printf("Yes\n");
break;
}
else if(j==len2){
printf("No\n");
break;
}
if(s1[i]==s2[j])
i++,j++;
else
j++;
}
}
return ;
}

POJ 1936 All in All(模拟)的更多相关文章

  1. poj 1008:Maya Calendar(模拟题,玛雅日历转换)

    Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64795   Accepted: 19978 D ...

  2. POJ 1027 The Same Game(模拟)

    题目链接 题意 : 一个10×15的格子,有三种颜色的球,颜色相同且在同一片内的球叫做cluster(具体解释就是,两个球颜色相同且一个球可以通过上下左右到达另一个球,则这两个球属于同一个cluste ...

  3. OpenJudge/Poj 1936 All in All

    1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...

  4. POJ 3414 Pots【bfs模拟倒水问题】

    链接: http://poj.org/problem?id=3414 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22009#probl ...

  5. poj 1936 All in All(水题)

    题目链接:http://poj.org/problem?id=1936 思路分析:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.算法时间复杂度O ...

  6. POJ 1936 All in All 匹配, 水题 难度:0

    题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已 ...

  7. poj 2632 Crashing Robots(模拟)

    链接:poj 2632 题意:在n*m的房间有num个机器,它们的坐标和方向已知,现给定一些指令及机器k运行的次数, L代表机器方向向左旋转90°,R代表机器方向向右旋转90°,F表示前进,每次前进一 ...

  8. poj 1028 Web Navigation(模拟)

    题目链接:http://poj.org/problem? id=1028 Description Standard web browsers contain features to move back ...

  9. POJ 3087 Shuffle'm Up (模拟+map)

    题目链接:http://poj.org/problem?id=3087 题目大意:已知两堆牌s1和s2的初始状态, 其牌数均为c,按给定规则能将他们相互交叉组合成一堆牌s12,再将s12的最底下的c块 ...

随机推荐

  1. 从源码编译rpi的内核

    Kernel Building https://www.raspberrypi.org/documentation/linux/kernel/building.md There are two mai ...

  2. Yii2 自动更新时间created_at updated_at

    创建model之后,新建一条记录,结果设计的表中created_at 字段 updated_at 字段 都是datetime 类型的,却不能自动插入当前时间.查看了资料,解决如下: 1.在class ...

  3. 用Android++在Visual Studio中用C/C++开发Android应用

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:用Android++在Visual Studio中用C/C++开发Android应用.

  4. 用Y分钟学会X

    Learn X in Y minutes是一个有趣的网站,里面列举了对很多编程语言和工具的极简教程,有各种语言版本的.

  5. CAS协议 - CAS URIs

    http://desert3.iteye.com/blog/1703449 2.CAS URIs:  CAS是一个基于HTTP的协议,这就要求其每一个组成部分可以通过特定的URIs访问到.所有相关的U ...

  6. TM1668 Led 驱动芯片源程序

    #define P_1668DAT_In RA0 //数据输入端口 #define P_1668DAT LATA0 //数据输出端口 #define P_1668CLK LATA1 #define P ...

  7. DataTable导入到Excel文件

        ;                saveFileDialog.RestoreDirectory = ;            , intIndex] = column.ColumnName; ...

  8. Spring 4.x org.springframework.http.converter.json.MappingJacksonHttpMessageConverter ClassNotFoundException:

    Spring 4.x The first major version of Jackson is no longer supported in Spring 4. The class you want ...

  9. Java反射_JDBC操作数据

    </pre><p>使用反射 来操作  这里是练习反射的使用</p><p>链接数据库工具类</p><p><pre name= ...

  10. CentOS系统下做nginx和tomcat负载均衡

    系统总是频繁更新,为了避免更新系统的时候领导看不到东西,打算用ngix做代理,后台部署两个tomcat做负载均衡,避免更新一台就无法使用系统的问题,这两天看了写资料,把几个关键点记录在这里以便备忘. ...