poj 1936 All in All

来源:互联网 发布:星光大道网络赛区 编辑:程序博客网 时间:2024/06/18 03:57

简单的模拟题,刚开始用dp做,未果。

#include<iostream>#include<string.h>#include<math.h>#include<fstream>#include<algorithm>#include<stdio.h>#include<queue>#include<vector> #define MAXSIZE 100using namespace std;char s1[100001], s2[100001];int main(){    //freopen("data_1936.txt","r",stdin);    while(scanf("%s%s", s1, s2) != EOF)    {        int l1 = strlen(s1);        int l2 = strlen(s2);        int j = 0;        for (int i = 0; i < l2; i++)        {            if (s2[i] == s1[j])            {                j++;            }            if (j == l1)            {                break;            }         }        if (j == l1)        {            printf("Yes\n");        }else        {            printf("No\n");        }    }    return 0;}
0 0
原创粉丝点击