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 ...
随机推荐
- IntelliJ IDEA字符串常量长度太长的问题解决:constant string too long
Java compiler下的Use compiler为Eclipse:
- jQuery--样式
Jquery(一)——样式篇1.$(document).ready 的作用是等页面的文档(document)中的节点都加载完毕后,再执行后续的代码, 因为我们在执行代码的时候,可能会依赖页面的某一个元 ...
- 【spring data jpa】jpa中使用count计数方法
spring data jpa中使用count计数方法很简单 直接在dao层写方法即可 int countByUidAndTenementId(String parentUid, String ten ...
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:3.安装Oracle RAC-3.1.安装并配置ASM驱动
3.1.安装并配置ASM驱动 3.3.1.检查内核 [root@linuxrac2 etc]# uname -r 2.6.18-164.el5 下载以下rpm包(注意rpm包版本和Linux内核版本一 ...
- DL380 G6 BIOS刷新方法
bios下载地址SP44873.exe (5.9 MB) http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.js ...
- javascript快速入门23--XHR—XMLHttpRequest对象
创建XMLHttpRequest对象 与之前众多DOM操作一样,创建XHR对象也具有兼容性问题:IE6及之前的版本使用ActiveXObject,IE7之后及其它浏览器使用XMLHttpRequest ...
- http://blog.csdn.net/huang_xw/article/details/7090173
http://blog.csdn.net/huang_xw/article/details/7090173
- Netty源码细节-accept、read(Linux os层 + Netty层代码细节)(转)
原文:http://budairenqin.iteye.com/blog/2215899 这篇分析一下accept的细节, 我觉得网络IO相关开发很多时候不能仅仅局限于java层, 尤其从accept ...
- 2017.11.30 tomcat远程调试
参考来自:http://blog.csdn.net/afgasdg/article/details/9236877 1.jpda 有两种方式,一种是修改tomcat的catalina.bat来配置jp ...
- 爪哇国新游记之二十九----访问URL获取输入流
代码: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import ...