POJ--1936 All in All(水题,暴力即可)
来源:互联网 发布:合肥美工招聘 编辑:程序博客网 时间:2024/05/16 23:36
All in All
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 30543 Accepted: 12723
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 <algorithm>#include <math.h>#include <stdlib.h>using namespace std;#define MAX 100000char a[MAX+5];char b[MAX+5];int main(){ int pos; bool res; while(scanf("%s%s",&a,&b)!=EOF) { pos=-1; res=true; int tag; int len1=strlen(a); int len2=strlen(b); for(int i=0;i<len1;i++) { tag=0; for(int j=0;j<len2;j++) { if(a[i]==b[j]) { if(j>pos) { tag=1; pos=j; break; } } } if(tag==0) res=false; } if(res==true) printf("Yes\n"); else printf("No\n"); }}
- 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(string)
- 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
- 红糖和赤砂糖
- STL算法库-删除算法
- 不是更快更强,而是更加自如——2015年终总结
- HTML转为markdown工具
- (转)java中short类型变量
- POJ--1936 All in All(水题,暴力即可)
- Windows平台分布式架构实践 - 负载均衡
- (转)JAVA中short和short相加自动转化为int
- TFA
- 诸神之战:世界秩序与现代中国
- 关于WM_NOTIFY及反射机制的来龙去脉
- [从头学数学] 第25节 认识时间
- hdoj1863畅通工程<最小生成树>
- Liblinear Visual studio 2013 Error C3057