OpenJudge/Poj 1936 All in All
2014-12-04 13:05
246 查看
1.链接地址:
http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936
2.题目:
All in All
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
Sample Output
Source
Ulm Local 2002
3.思路:
4.代码:
http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936
2.题目:
All in All
Time Limit: 1000MS | Memory Limit: 30000K | |
Total Submissions: 26651 | Accepted: 10862 |
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
Source
Ulm Local 2002
3.思路:
4.代码:
1 #include "stdio.h" 2 //#include "stdlib.h" 3 #include "string.h" 4 #define NUM 100002 5 char s[NUM],t[NUM]; 6 int main() 7 { 8 int i,j; 9 int len_s,len_t; 10 while(scanf("%s%s",s,t) != EOF) 11 { 12 len_s=strlen(s); 13 len_t=strlen(t); 14 i=0;j=0; 15 while(i<len_s && j<len_t) 16 { 17 if(s[i]==t[j]) i++; 18 j++; 19 } 20 //printf("%s%s\n",s,t); 21 if(i>=len_s) printf("Yes\n"); 22 else printf("No\n"); 23 } 24 //system("pause"); 25 return 0; 26 }
相关文章推荐
- OpenJudge/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
- 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
- POJ1936-All in All
- POJ1936-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