zoukankan      html  css  js  c++  java
  • uva10340

    Problem E

    All in All

    Input: standard input

    Output: standard output

    Time Limit: 2 seconds

    Memory Limit: 32 MB

    You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.

    Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.

    Input Specification

    The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace. Input is terminated by EOF.

    Output Specification

    For each test case output, if s is a subsequence of t.

    Sample Input

    sequence subsequence
    person compression
    VERDI vivaVittorioEmanueleReDiItalia
    caseDoesMatter CaseDoesMatter

    Sample Output

    Yes
    No
    Yes
    No
    题目大意:判断字符数组是不是另一个的子串(删除n个字符,n可以等于0)
    分析:水题
     1 #include<iostream>
     2 #include<cstring>
     3 #include<cstdlib>
     4 #include<cstdio>
     5 #include<cmath>
     6 #include<string>
     7 using namespace std;
     8 string a,b;
     9 int main()
    10 {
    11     while(cin>>a>>b)
    12     {
    13         int flag=0,lena=a.size(),lenb=b.size();
    14         for(int i=0; i<lenb; i++)
    15         {
    16             if(flag==lena)
    17                 break;
    18             else  if(a[flag]==b[i])
    19                 flag++;
    20         }
    21         if(flag==lena)
    22             cout<<"Yes"<<endl;
    23         else
    24             cout<<"No"<<endl;
    25     }
    26     return 0;
    27 }
    View Code
  • 相关阅读:
    PHP防采集方法代码
    Borland C++ Builder 编译绿色Exe程序
    关于结构体构造函数使用总结
    Ubuntu18下移植飞凌的QT4.8.5
    qt在arm平台中,把鼠标指针消失。
    ubuntu下gcc g++操作
    Ubuntu下Qt_Creator支持搜狗中文输入
    ubuntu18.04.1降级交叉编译器 arm-linux-gcc-4.4.3
    error: narrowing conversion of '4323168000' from 'long int' to 'float' inside { } [-Wnarrowing] }; ^
    #pragma pack(1)的意义
  • 原文地址:https://www.cnblogs.com/shuzy/p/3188291.html
Copyright © 2011-2022 走看看