poj 1936 All in All
来源:互联网 发布:qq直播是什么软件 编辑:程序博客网 时间:2024/06/15 17:08
All in All
Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 29339 Accepted: 12170
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.
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 subsequenceperson compressionVERDI vivaVittorioEmanueleReDiItaliacaseDoesMatter CaseDoesMatter
Sample Output
YesNoYesNo
Source
Ulm Local 2002
问第一个字符串包含在第二中么
直接暴力吧
#include <iostream>#include <string.h>#include <stdio.h>#include <map>#include <set>#include <algorithm>#include <vector>#include <queue>#include <stack>#include <math.h>#include <stdlib.h>using namespace std;#define Max 100010char t1[Max],t2[Max];int al[233];int bl[233];int main(){while(~scanf("%s%s",t1,t2)){int l1=strlen(t1);int l2=strlen(t2);int flag=0;long long pos_1=0,pos_2=0;while(1){if(pos_1==l1){flag=1;break;}else if(pos_2==l2&&pos_1!=l1){break;}if(t1[pos_1]==t2[pos_2]){pos_1++;pos_2++;}else pos_2++;}if(!flag) cout<<"No"<<endl;else cout<<"Yes"<<endl;}return 0;}
0 0
- poj 1936 "all in all"
- poj 1936 All in All
- POJ 1936 All in All
- poj 1936 All in All
- POJ 1936 all in all
- POJ 1936 All in All
- POJ 1936 All in All
- POJ 1936 All in All
- POJ-1936-All in All
- poj 1936 all in all
- poj 1936 All in All
- POJ 1936 All in ALL
- poj 1936 All in All
- poj 1936 All in All
- POJ 1936 All in All
- All in All(poj 1936)
- poj 1936 All in All
- poj 1936 All in All
- 自己实现基于key-value的NoSQL数据库(一)——起步,初版
- gradle入门指南
- jquery 使用方法
- sgu275:To xor or not to xor(最大异或和)
- JXL报BiffException解决方案
- poj 1936 All in All
- 单链表C++类模板实现
- Mysql Oracle Java 数据类型对照
- Effective C++条款26解读: 尽可能延后变量定义式的出现时间
- 在VS2010下MFC采用ADO方式连接ACCESS数据库(详细过程)
- 学习笔记(objective-c)-协议(protocol)
- 归并排序
- android新建程序时出现Errors occurred during the build
- APMServ5.2.6安装PHP框架Yii2详细教程