All in All

Time Limit: 1000 MS Memory Limit: 30000 KB

64-bit integer IO format: %I64d , %I64u   Java class name: Main

[Submit] [Status] [Discuss]

Description

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

The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace.The length of s and t will no more than 100000.

Output

For each test case output "Yes", if s is a subsequence of t,otherwise output "No".

Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter

Sample Output

Yes
No
Yes
No 题意:第一个串是否是第二个的子串 区分大小写 依旧前几道题暴力的思想
#include <iostream>
#include <string.h>
#include <stdio.h> using namespace std; int main()
{
long long int i,j; ///int会超
char s1[],s2[];
while(scanf("%s",s1)!=EOF)
{
scanf("%s",s2);
long len1=strlen(s1);
long len2=strlen(s2);
i=;
j=;
while(true)
{
if(i==len1)
{
cout<<"Yes"<<endl;
break;
}
else if(i<len1 && j==len2)
{
cout<<"No"<<endl;
break;
}
if(s1[i]==s2[j])
{
i++;
j++;
}
else
j++;
}
memset(s1,'\0',sizeof(s1));
memset(s2,'\0',sizeof(s2));
}
return ;
}

poj 1936 All in All的更多相关文章

  1. OpenJudge/Poj 1936 All in All

    1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...

  2. POJ 1936 All in All(模拟)

    All in All 题目链接:http://poj.org/problem?id=1936 题目大意:判断从字符串s2中能否找到子串s1.字符串长度为10W. Sample Input sequen ...

  3. poj 1936 All in All(水题)

    题目链接:http://poj.org/problem?id=1936 思路分析:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.算法时间复杂度O ...

  4. POJ 1936 All in All 匹配, 水题 难度:0

    题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已 ...

  5. Poj 1936,3302 Subsequence(LCS)

    一.Description(3302) Given a string s of length n, a subsequence of it, is defined as another string ...

  6. POJ 1936

    #include<iostream> #include<string> using namespace std; int main() { //freopen("ac ...

  7. 简单的字符串比较题 POJ 1936

    Description You have devised a new encryption technique which encodes a message by inserting between ...

  8. All in All - poj 1936 (子串)

    字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.   #include <iostream> #include <string. ...

  9. POJ 1936 All in All(串)

    All in All Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 27537 Accepted: 11274 Descript ...

随机推荐

  1. 2016-06-06:X264码率控制

    H.264与x264 H264是一个视频压缩编码标准.https://zh.wikipedia.org/wiki/H.264/MPEG-4_AVC X264实现H264视频压缩标准的开源项目.http ...

  2. 使用 Intellij Idea 导出JavaDoc

    使用/* ...... /来注释代码,解释方法参数,返回参数,类的功能及用法. 常用的注释标签: @author 作者 @version 版本 @see 参考转向 @param 参数说明 @retur ...

  3. 用asp.net c# HttpWebRequest获取网页源代码

    public string GetPage(string url) { HttpWebRequest request = null; HttpWebResponse response = null; ...

  4. Python自动化 【第八篇】:Python基础-Socket编程进阶

    本节内容: Socket语法及相关 SocketServer实现多并发 1. Socket语法及相关 sk = socket.socket(socket.AF_INET,socket.SOCK_STR ...

  5. iOS 原生态扫描二维码、条形码的功能。

    1.导入AVFoundatin.framework. 2.新建一个viewController,命名为QRScanViewController,用于扫描的界面. h文件如下,设置代理. #import ...

  6. delphi Inc函数和Dec函数的用法

    inc自增函数 .inc(i,n)://i,n:integer;n为自增量 相当于i:=i+n: .inc(i)://i:integer; 相当于i:=i+;   dec自减函数 .dec(i,n): ...

  7. {Reship}{C#}{GDI+}GDI+画笔,线,区域类型

    =================================================================================== This article is ...

  8. 记录今天学习python中for与while循环针对break和continue的用法

    python中有两个主要的循环for与while,其中针对这两个循环有两种不同的中断用法break与continue. 首先先看下面的循环代码: 1: for i in range(10):#变量i带 ...

  9. .net该的帐

    1.web api 2.socket通信 3.NUnit单元测试 4.了解自动化测试各种工具

  10. Intel 82599 万兆网卡

    http://www.cnblogs.com/zhuyp1015/archive/2012/08/23/2653264.html http://bbs.chinaunix.net/thread-424 ...