UVA - 10340 All in All

来源:互联网 发布:淘宝亿次元 编辑:程序博客网 时间:2024/06/08 19:06

题目链接:UVA - 10340 All in All

      为了获得良好的看书体验,还是做一下好。给定两个序列s,t,问你s是否是t的子序列。

# include <cstdlib># include <cstdio># include <algorithm># include <cmath># include <cstring>using namespace std;  const int size = 1000000 + 30;  char s[size],t[size];int main(){while (scanf("%s%s",s,t)!=EOF){int i,j;for (i=j=0;t[i]!='\0';i++){if (s[j]==t[i])j++;}if (s[j]=='\0')printf("Yes\n");else printf("No\n");}    return 0;}


0 0
原创粉丝点击