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. MyBatis学习总结(八)——Mybatis3.x与Spring4.x整合

    一.搭建开发环境 1.1.使用Maven创建Web项目 执行如下命令: mvn archetype:create -DgroupId=me.gacl -DartifactId=spring4-myba ...

  2. JS生成雪花

    <script type="text/javascript"> (function(){ function snow(left,height,src){ var div ...

  3. mysql的时间转化

    1.1 获得当前日期+时间(date + time)函数:now() 除了 now() 函数能获得当前的日期时间外,MySQL 中还有下面的函数: current_timestamp()   curr ...

  4. glReadPixels函数

    GPU渲染完数据在显存,回传内存的唯一方式glReadPixels函数... glReadPixels:读取一些像素.当前可以简单理解为“把已经绘制好的像素(它可能已经被保存到显卡的显存中)读取到内存 ...

  5. RSA加密前端JS加密,后端asp.net解密,报异常

    RSA加密前端JS加密,后端asp.net解密,报异常 参考引用:http://www.ohdave.com/rsa/的JS加密库 前端JS加密代码: function GetChangeStr() ...

  6. ecshop的弊病和需要修改的地方,持续更新

    ecshop的session机制是基于cookie的,用数据库进行缓存,当浏览器关闭cookie,sessions表会爆表,所以需要改进. 在cls_template.php中 $_echash值是固 ...

  7. 为什么匿名内部类和局部内部类只能访问final变量

    因为虽然匿名内部类在方法的内部,但实际编译的时候,内部类编译成Outer.Inner,这说明内部类所处的位置和外部类中的方法处在同一个等级上,外部类中的方法中的变量或参数只是方法的局部变量,这些变量或 ...

  8. 1-9 TCP/IP参考模型

    ISO/OSI参考模型与TCP/IP模型对比 一.网络访问层 功能:包括IP地址与物理硬件地址的映射以及将IP地址封装成帧. 基于不同类型的网络接口,网路访问层定义了和物理介质的连接 网路访问层包含了 ...

  9. CSS背景图拉伸自适应尺寸,全浏览器兼容

    突然有人问我这个问题,说网上CSS filter的方法在非IE浏览器下不奏效.思考之后,问题之外让我感慨万千啊,很多我们所谓的难题,都会随着时代的发展迎刃而解,或被新的问题所取代. 当CSS背景图片拉 ...

  10. poj 2987 最大权闭合图

    Language: Default Firing Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 8744   Accept ...