NUC1657 All in All【字符串匹配】
来源:互联网 发布:sql 镜像服务器 编辑:程序博客网 时间:2024/06/06 19:44
All in All
时间限制: 1000ms 内存限制: 30000KB
通过次数: 1总提交次数: 1
问题描述
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.
输入描述
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.
输出描述
For each test case output "Yes", if s is a subsequence of t,otherwise output "No".
样例输入
sequence subsequenceperson compressionVERDI vivaVittorioEmanueleReDiItaliacaseDoesMatter CaseDoesMatter
样例输出
YesNoYesNo
来源
Ulm Local 2002
问题分析:(略)
这个问题和《UVA10340 POJ1936 ZOJ1970 All in All【字符串匹配】》是同一个问题,代码拿过来用就AC了。
程序说明:参见参考链接。
参考链接:UVA10340 POJ1936 ZOJ1970 All in All【字符串匹配】
题记:程序做多了,不定哪天遇见似曾相识的。AC的C++程序如下:
/* UVA10340 POJ1936 ZOJ1970 All in All */#include <stdio.h>#include <string.h>#define MAXN 110000char s[MAXN], t[MAXN];int delstrcmp(char *s, char *t){ int i, j, slen, tlen; slen = strlen(s); tlen = strlen(t); for(i=0, j=0; i<slen && j<tlen;) { if(s[i] == t[j]) { i++; j++; } else j++; } return i == slen;}int main(void){ while(scanf("%s%s", s, t) != EOF) printf("%s\n", delstrcmp(s, t) ? "Yes" : "No"); return 0;}
阅读全文
0 0
- NUC1657 All in All【字符串匹配】
- Uva 10340 all in all (字符串匹配)
- UVA 10340- All in All(字符串匹配)
- POJ 1936 All in All 字符串匹配
- All in All(字符串)
- UVA10340 All in All (字符串匹配+水题)
- poj 1936 All in All 简单的字符串匹配
- uva:10340 - All in All(字符串匹配)
- [POJ](1936)All in All ---字符串匹配(串)
- uva10340 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 (字符串处理)
- POJ1936 All in All 字符串水题
- poj_1936 All in All(简单字符串)
- UVa 10340:All in All(字符串)
- 【机器学习算法模型】分类算法——k近邻法
- 计算几何问题汇总--点与线的位置关系
- BZOJ 2882: 工艺 最小表示法
- 怎么解决Windows自动更新问题
- java元注解和自定义注解的使用方法
- NUC1657 All in All【字符串匹配】
- 浅谈矩阵分解在推荐系统中的应用
- Android 图片压缩
- 文章标题
- NUC1077 Humble Numbers【数学计算+打表】
- ACCESS数据库时间应用之按时间段对字段进行分组
- 人工智能泰斗迈克尔·乔丹分享机器学习要义:创新视角,直面挑战
- 爬虫学习-selenium+chrome
- NUC1421 时间日期格式转换【日期计算】