UVa 10340 - All in All

来源:互联网 发布:js splice 数组 编辑:程序博客网 时间:2024/06/06 16:37

   把问题想复杂就是Time limit exceeded。



#include<stdio.h>#include<string.h>char s[1000000],t[10000000];int main(){    int i,j,ls,lt;    while(scanf("%s%s",s,t)!=EOF)    {        j=0;        int nls;        ls=strlen(s);        lt=strlen(t);        for(i=0;i<lt;i++)        {            if(t[i]==s[j])                j++;            if(j==ls)                break;        }        if(j==ls)            printf("Yes\n");        else            printf("No\n");    }    return 0;}


0 0