POJ 1936
发布日期:2021-06-30 15:31:06 浏览次数:2 分类:技术文章

本文共 1494 字,大约阅读时间需要 4 分钟。

All in All

Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 35713   Accepted: 14896

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 subsequenceperson compressionVERDI vivaVittorioEmanueleReDiItaliacaseDoesMatter CaseDoesMatter

Sample Output

YesNoYesNo

Source

水题,在一个字符串里判断是否包含另一个,但长度最大是100000,INT达不到,所以要使用long

代码:

#include
#include
using namespace std; int main(){ char s1[100000],s2[100000]; long i, j; while(cin>>s1>>s2) { long len1=strlen(s1); long len2=strlen(s2); i=0; j=0; while(true) { if(i==len1) { cout<<"Yes"<

 

转载地址:https://joycez.blog.csdn.net/article/details/83096836 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:POJ 2299
下一篇:POJ 1804

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年05月02日 02时59分06秒