时间复杂度O(n)

 #include <stdio.h>
#include <string.h>
int main(){
int al,bl,i,j;
char a[+];
char b[+];
while(~scanf("%s%s",a,b)){
al=strlen(a);
bl=strlen(b);
for(i=,j=;i<bl;++i){
if(a[j]==b[i])
j++;
}
if(j==al)
printf("Yes\n");
else
printf("No\n");
}
return ;
}

poj1936_All in All的更多相关文章

随机推荐

  1. ylbtech-Unitity-CS:AnonymousDelegates

    ylbtech-Unitity-CS:AnonymousDelegates 1.A,效果图返回顶部   1.B,源代码返回顶部 1.B.1, using System; using System.Co ...

  2. 常见数组&字符串API及其应用场景总结

    数组API: String(arr):将arr中每个元素转化为字符串,逗号连接     场景:用于鉴别数据有没有修改等. ps:String是万能的   toString 只能转换除null和unde ...

  3. 配置nginx下别名alias支持PHP fastcgi解析

    1)参看如下连篇文章:Nginx设置alias实现虚拟目录 alias与root的用法区别http://down.chinaz.com/server/201111/1382_1.htmNginx下al ...

  4. Mybatis where 1=1 和 <where>标签

    <select id="selSampleListByIDX4" resultMap="BaseResultMap" parameterType=&quo ...

  5. zkclient

    zkclient 快速指南 Maven依赖 最新的版本发布在Maven中央库. <dependency> <groupId>com.github.adyliu</grou ...

  6. sql如何获取一个时间段内的月份

    ),) from master..spt_values where type='P' and dateadd(month,number,'2010-01-01')<='2010-09-01' / ...

  7. 动态添加js文件.

    方法一: $.getScript(url,callback); 这个方法是对$.ajax({ })的封装.默认是异步的而且是带有缓存的. 缓存对于用户来说,是个好东西,但是对于开发者来说可就是日了狗的 ...

  8. 异步任务神器 Celery 简明笔记

    转自:http://www.jianshu.com/p/1840035cb510 异步任务 异步任务是web开发中一个很常见的方法.对于一些耗时耗资源的操作,往往从主应用中隔离,通过异步的方式执行.简 ...

  9. Mingyang.net:为什么不将Bean定义在Action参数中?

    Spring MVC提供了一种方便的Bean填充方式: @Controller public class CmsChannelController extends AbstractController ...

  10. LeetCode 58. Length of Last Word

    Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...