UVa 10340 子序列
来源:互联网 发布:网络教育专科学费多少 编辑:程序博客网 时间:2024/05/20 16:11
10340 - All in All
Time limit: 3.000 seconds
Problem E
All in All
Input: standard input
Output: standard output
Time Limit: 2 seconds
Memory Limit: 32 MB
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 Specification
The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace. Input is terminated by EOF.
Output Specification
For each test case output, if s is a subsequence of t.
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No
#include <stdio.h>#include <string.h>char s[100000];char t[100000];int yes_or_no(const char *s,const char *t);int main(int argc, const char * argv[]) { while (scanf("%s %s",s,t)!= EOF) { if (yes_or_no(s, t)) { printf("Yes\n"); } else printf("No\n"); } return 0;}int yes_or_no(const char *s,const char *t){ int j = 0; for (int i = 0; i < strlen(s); ++i,++j) { while (j < strlen(t) && t[j]!=s[i]) ++j; if (j == strlen(t)) return 0; } return 1;}
- UVa 10340 子序列
- UVA 10340 子序列
- UVa 10340 子序列
- uva 10340 子序列
- UVa 10340 子序列
- UVa 10340(子序列)
- 子序列(uva- 10340)
- UVA-3.9-子序列-10340
- 子序列(All in All, UVa 10340)
- uva 1121 - Subsequence(子序列)
- uva 10131 最长子序列
- UVA 10340 All in All 子序列判定 贪心
- UVa 10340 All in All(子序列)
- UVa - 10340 - All in All(暴力遍历、子序列)
- 最长公共子序列uva--111
- UVA 231 最长下降子序列
- Vacation - UVa 10192 最长公共子序列
- uva 111(最长公共子序列)
- 「OpenGL 1 」关于基本图形绘制
- C语言大世界————02剑指指针
- Spring整合Struts2注意事项
- c++中冒号(:)和双冒号(::)的用法
- Reflected File Download - A New Web Attack Vector
- UVa 10340 子序列
- 蛋疼的Android输入法
- HTTP 状态代码
- 解释为什么imgView要打开点击事件【事件响应链】
- LeetCode 149 Longest Substring Without Repeating Characters
- Android开源项目分类汇总
- 现在创业者都喜欢给用户写公开信,我也是,要不看看我写的是否合格?
- Nginx Rewrite规则认识
- Ubuntu14.04安装JDK