时间复杂度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. poj 3040 Allowance

    Allowance Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1842   Accepted: 763 Descript ...

  2. ssh 连接ubuntu的虚拟机问题

    我在winxp的虚拟机上装了一个ubuntu9.04的系统,winxp的ip为10.118.62.157,ubuntu的ip为192.168.116.1 两个ip互相ping都是正常的,但是,我在wi ...

  3. 启动httpd服务:SSLCertificateFile: file '/var/www/miq/vmdb/certs/server.cer' does not exist or is empty

    启动httpd服务,失败: [root@test vmdb]# service httpd restart Stopping httpd: [FAILED] Starting httpd: Synta ...

  4. sqlite 时间排序

    select * from tb_QuantifyResult where iSamplingOrCalibration = 1 and cComponentName <> ' + Quo ...

  5. ElasticSearch 常用的查询过滤语句

    query 和  filter 的区别请看: http://www.cnblogs.com/ghj1976/p/5292740.html Filter DSL term 过滤 term主要用于精确匹配 ...

  6. Prevent Adding Component More than once

    Question: I'm developing a C# component, I want to prevent the user from adding this component to th ...

  7. Codeforces 626D Jerry's Protest 「数学组合」「数学概率」

    题意: 一个袋子里装了n个球,每个球都有编号.甲乙二人从每次随机得从袋子里不放回的取出一个球,如果甲取出的球比乙取出的球编号大则甲胜,否则乙胜.保证球的编号xi各不相同.每轮比赛完了之后把取出的两球放 ...

  8. [HDU 4821] String (字符串哈希)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4821 题目大意:给你M,L两个字母,问你给定字串里不含M个长度为L的两两相同的子串有多少个? 哈希+枚 ...

  9. HTTP 和 HTTPS 协议

    HTTP协议是什么? 简单来说,就是一个基于应用层的通信规范:双方要进行通信,大家都要遵守一个规范,这个规范就是HTTP协议. HTTP协议能做什么? 很多人首先一定会想到:浏览网页.没错,浏览网页是 ...

  10. (转)如何检查系统是否支持Zend Optimizer

    原文地址:http://blog.chinaunix.net/uid-25266990-id-2978539.html Zend Optimizer 主要有两个功能: 1.可以加速 PHP 脚本的执行 ...