All in All
Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 29651   Accepted: 12312

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

  1. sequence subsequence
  2. person compression
  3. VERDI vivaVittorioEmanueleReDiItalia
  4. caseDoesMatter CaseDoesMatter

Sample Output

  1. Yes
  2. No
  3. Yes
  4. No
  5.  
  1. #include<string.h>
  2. #include<stdio.h>
  3. #include<iostream>
  4. #include<algorithm>
  5. using namespace std;
  6. char s[],t[];
  7. int main(){
  8. while(scanf("%s %s",s,t)!=EOF){
  9. getchar();
  10. int len1=strlen(s);
  11. int len2=strlen(t);
  12. int ans=;
  13. for(int i=;i<len2;i++){
  14. if(s[ans]==t[i]){
  15. ans++;
  16. }
  17. }
  18. if(ans==len1)
  19. printf("Yes\n");
  20. else
  21.  
  22. printf("No\n");
  23. memset(s,,sizeof(s));
  24. memset(t,,sizeof(t));
  25. }
  26. return ;
  27. }

poj1936 假期计划第一水的更多相关文章

  1. hihoCoder#1698 : 假期计划 组合数

    题面:hihoCoder#1698 : 假期计划  组合数 题解: 题目要求是有序的排列,因此我们可以在一开始就乘上A!*B!然后在把这个序列划分成很多段. 这样的话由于乘了阶乘,所以所有排列我们都已 ...

  2. hihocoder #1698 假期计划 (排列组合+费马小定理+乘法逆元)

    Description 小Ho未来有一个为期N天的假期,他计划在假期中看A部电影,刷B道编程题.为了劳逸结合,他决定先拿出若干天看电影,再拿出若干天刷题,最后再留若干天看电影.(若干代指大于0)  每 ...

  3. [No000016]为什么假期计划总是做不到?

  4. [USACO13DEC]假期计划(黄金)Vacation Planning (gold)

    题目翻译不好,这里给出一份 题目背景 Awson是某国际学校信竞组的一只大佬.由于他太大佬了,于是干脆放弃了考前最后的集训,开车(他可是老司机)去度假.离开学校前,他打开地图,打算做些规划. 题目描述 ...

  5. 洛谷P3094 [USACO13DEC]假期计划Vacation Planning

    题目描述 有N(1 <= N <= 200)个农场,用1..N编号.航空公司计划在农场间建立航线.对于任意一条航线,选择农场1..K中的农场作为枢纽(1 <= K <= 100 ...

  6. c++ imooc自学计划

    一.视频学习相关的课程列表: C++远征之起航篇http://www.imooc.com/learn/342: C++远征之离港篇http://www.imooc.com/learn/381: C++ ...

  7. JavaScript和jQuery的学习

    还有12天就要回学校了,我的假期计划还能实现吗?在这12天里,需要把JavaScript和jQuery学完.我知道这两个技术对于前端网页开发非常重要.前期把HTML和CSS学完了,学的不是特别深,只是 ...

  8. [Offer收割]编程练习赛48

    题目1 : 折线中点 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定平面上N个点P1, P2, ... PN,将他们按顺序连起来,形成一条折线. 请你求出这条折线的 ...

  9. 【Luogu】P3745期末考试(三分)

    题目链接 我是怎么把“期末考试”在本地写成“假期计划”的 qwq???? 本题把学生和卷子都排个序,按出成绩最晚时间三分. 三分之后可以O(n)的时间统计答案,因为修改卷子出成绩的时间可以贪心计划. ...

随机推荐

  1. pdo->prepare 返回false的问题总结

    报错信息: Fatal error: Call to a member function execute() on a non-object 一般是pdo->prepare 返回了false导致 ...

  2. 转:SpringCloud服务注册中心比较:Consul vs Zookeeper vs Etcd vs Eureka

    原文链接地址:http://luyiisme.github.io/2017/04/22/spring-cloud-service-discovery-products/ 这里就平时经常用到的服务发现的 ...

  3. 爱她就用python给她画个小心心 ♥(ˆ◡ˆԅ)

    from turtle import * a = Turtle() screensize(400, 300, "blue") setup(width=1300, height=65 ...

  4. 【Mysql】给mysql配置远程登录

    grant all privileges on 库名.表名 to '用户名'@'IP地址' identified by '密码' with grant option; flush privileges ...

  5. css3 媒体查询的学习。

    1.什么是媒体查询 媒体查询可以让我们根据设备显示器的特性(如视口宽度.屏幕比例.设备方向:横向或纵向)为其设定CSS样式,媒体查询由媒体类型和一个或多个检测媒体特性的条件表达式组成.媒体查询中可用于 ...

  6. 【PHP项目】$_SEVER详解

    $_SERVER['HTTP_ACCEPT_LANGUAGE']//浏览器语言 $_SERVER['REMOTE_ADDR'] //当前用户 IP . $_SERVER['REMOTE_HOST'] ...

  7. 易语言制作的QQ聊天中常用的GIF图片【带源码下载】

    该软件调用网页实现表情包制作,使用了精益模块. 最近比较火的王境泽.张学友.切格瓦拉.为所欲为.今天星期五.黑人问号脸.偷电瓶车.诸葛孔明.金坷垃等都可以通过此软件在线制作属于你的表情包. 太困了懒得 ...

  8. linux通用GPIO驱动,写GPIO文件不立即生效问题解决

    Linux开发平台实现了通用GPIO的驱动,用户通过,SHell或者系统调用能控制GPIO的输出和读取其输入值.其属性文件均在/sys/class/gpio/目录下,该目录下有export和unexp ...

  9. 笨小熊 南阳acm62

    笨小熊 时间限制:2000 ms  |  内存限制:65535 KB 难度:2   描述 笨小熊的词汇量很小,所以每次做英语选择题的时候都很头疼.但是他找到了一种方法,经试验证明,用这种方法去选择选项 ...

  10. B1018 锤子剪刀布 (20分)

    B1018 锤子剪刀布 (20分) 大家应该都会玩"锤子剪刀布"的游戏:两人同时给出手势. 现给出两人的交锋记录,请统计双方的胜.平.负次数,并且给出双方分别出什么手势的胜算最大. ...