All in All - poj 1936 (子串)
#include <iostream>
#include <string.h>
using namespace std;
char s[];
char t[];
int main() { while(cin>>s>>t){
int length1=strlen(s);
int length2=strlen(t);
int i=,j=;
for(i=,j=;i<length1&&j<length2;){
if(s[i]==t[j]){
i++;
j++;
}else{
j++;
}
}
if(i==length1)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return ;
}
附:
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 29592 | Accepted: 12269 |
Description
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
Output
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No
All in All - poj 1936 (子串)的更多相关文章
- POJ 1936 All in All(模拟)
All in All 题目链接:http://poj.org/problem?id=1936 题目大意:判断从字符串s2中能否找到子串s1.字符串长度为10W. Sample Input sequen ...
- POJ 1936 All in All 匹配, 水题 难度:0
题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已 ...
- OpenJudge/Poj 1936 All in All
1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...
- poj 1936 All in All(水题)
题目链接:http://poj.org/problem?id=1936 思路分析:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.算法时间复杂度O ...
- poj 1936 All in All
All in All Time Limit: 1000 MS Memory Limit: 30000 KB 64-bit integer IO format: %I64d , %I64u Java ...
- Poj 1936,3302 Subsequence(LCS)
一.Description(3302) Given a string s of length n, a subsequence of it, is defined as another string ...
- POJ 1936
#include<iostream> #include<string> using namespace std; int main() { //freopen("ac ...
- 简单的字符串比较题 POJ 1936
Description You have devised a new encryption technique which encodes a message by inserting between ...
- POJ 1936 All in All(串)
All in All Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 27537 Accepted: 11274 Descript ...
随机推荐
- 可见性-volatile
出处: http://blog.csdn.net/vking_wang/article/details/9982709
- ueditor-angular(百度编辑器angular版)中,关于插入图片后不操作,图片无法正常提交的问题;
由于项目后台管理页面中需要使用编辑器,所以选择了百度编辑器这个常用的东西: 本人是小白,第一次使用百度编辑器,具体的配置是由后台的兄弟完成的,还给了demo,所以在项目开发中也一直都没发现什么问题: ...
- oracle 11g jdbc jar包在哪个文件目录
一. 如果装了oracle数据库的话, 大致是这样的目录: D:\oracle\product\11.2.0\client_1\oui\jlib\classes12.jar 或者 D:\o ...
- Kubernetes环境下如何运行Coherence缓存集群
Oracle官方出了一个如何在Docker环境下运行Coherence的技术文档,大家可以参考: https://github.com/oracle/docker-images/tree/master ...
- Python扫描指定文件夹下(包含子文件夹)的文件
扫描指定文件夹下的文件.或者匹配指定后缀和前缀的函数. 假设要扫描指定文件夹下的文件,包含子文件夹,调用scan_files("/export/home/test/") 假设要扫描 ...
- 写一个函数判断字符串中"{"与"}","["与"]","("与")"匹配,"{"必须在"}"前面,"["必须在"]"前面,"("必须在")"前面,可以嵌套
boolean matchBracket( String str ) { Stack stack = new Stack(); try { for ( int i = 0; i < str.le ...
- VR/AR工作原理、目前存在的技术问题
http://blog.csdn.net/liulong1567/article/details/50686558 摘要: 这些挑战,每一个都还需要很多努力才能解决.目前它们很多都还不到量变(只是需要 ...
- Spark Streaming揭秘 Day1-三大谜团
Spark Streaming揭秘 Day1 三大谜团 引子 在Spark的众多组件中,Streaming最接近企业级应用程序,学习Spark Streaming,是掌握大数据技术的一条捷径.今天是第 ...
- [Spring boot] Application properties and configurations
We can use different application properties application.properties: server.port=9090 application-pro ...
- JAVA加解密 -- 数字签名算法
数字签名 – 带有密钥的消息摘要算法 作用:验证数据完整性.认证数据来源.抗否认(OSI参考模型) 私钥签名,公钥验证 RSA 包含非对称算法和数字签名算法 实现代码: //1.初始化密钥 KeyPa ...