博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj 1936 -- All in All
阅读量:5905 次
发布时间:2019-06-19

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

All in All
Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 27556   Accepted: 11286

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 水题。
1 #include 
2 #include
3 #include
4 #define M 100005 5 char s[M]={
0},t[M]={
0}; 6 using namespace std; 7 int main() 8 { 9 while(scanf("%s %s",s,t)!=EOF){10 int i,j;11 i=j=0;12 while(s[i]&&t[j]){13 if(s[i]==t[j]){14 i++;15 j++;16 }17 else j++;18 }19 if(s[i])20 printf("No\n");21 else printf("Yes\n");22 memset(s,0,sizeof(s));23 memset(t,0,sizeof(t));24 }25 return 0;26 }
View Code

转载于:https://www.cnblogs.com/ubuntu-kevin/p/3856030.html

你可能感兴趣的文章
mysql安装,远程连接,以及修改密码
查看>>
Mybatis查询返回Map类型数据
查看>>
java的深拷贝与浅拷贝
查看>>
程序员如何提高工作效率
查看>>
promise
查看>>
将Java应用部署到SAP云平台neo环境的两种方式
查看>>
数据批量导入Oracle数据库
查看>>
调用lumisoft组件发邮件 不需要身份验证 不需要密码
查看>>
DW 正则
查看>>
抓屏原理
查看>>
UNIX网络编程读书笔记:TCP输出、UDP输出和SCTP输出
查看>>
扩展 DbUtility (1)
查看>>
iOS开发UI篇—使用picker View控件完成一个简单的选餐应用
查看>>
Hadoop学习笔记系列文章导航
查看>>
SpringMVC中ModelAndView addObject()设置的值jsp取不到的问题
查看>>
Prometheus : 入门
查看>>
使用 PowerShell 创建和修改 ExpressRoute 线路
查看>>
在C#中获取如PHP函数time()一样的时间戳
查看>>
Redis List数据类型
查看>>
大数据项目实践(四)——之Hive配置
查看>>