UVA All in All(水题)
2015-02-02 16:00
267 查看
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
Sample Output
Source: ULM Local Contest
[/code]
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
Source: ULM Local Contest
代码:
[code]#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char a[10001000];
char str[1001000];
int main()
{
while(scanf("%s%s",str,a)!=EOF)
{
int len = strlen(str);
int k = 0;
int flag = 0;
for(int i=0;a[i]!='\0';i++)
{
if(str[k] == a[i])
{
k++;
}
if(k == len)
{
flag = 1;
break;
}
}
if(flag == 1)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
return 0;
}
[/code]
相关文章推荐
- UVa12114 - Bachelor Arithmetic(水题)
- UVA11636-Hello World!-水题
- UVa11278 - One-Handed Typist(水题)
- UVALive 2318 水题
- (考前水题) UVa 11488 Trie树
- 【数值方法,水题】UVa 10341 - Solve It
- 水题(决斗,uva 1636)
- UVA - 10608 Friends 并查集水题
- UVALive6336 HDU4450 Draw Something【水题】
- UVA 11389 The Bus Driver Problem 贪心水题
- UVA 11100 The Trip, 2007 水题一枚
- UVA - 10976 Fractions Again?!(水题)
- UVA 11100 The Trip, 2007——水题
- Uva 1388 Graveyard - 水题
- UVa 10935 (水题) Throwing cards away I
- 水题:UVa133-The Dole Queue
- 水题:UVa213- Message Decoding
- UVA - 10340 All in All(水题)
- UVALive 7270 Osu! Master 水题
- uva 11556 - Best Compression Ever(水题)