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 whichencodes a message by inserting between its characters randomly generatedstrings in a clever way. Because of pending patent issues we will not discussin detail how the strings are generated and inserted into the original message.To validate your method, however, it is necessary to write a program thatchecks if the message is really encoded in the final string.

Given two strings s and t, you haveto decide whether s is a subsequence of t, i.e. if you can removecharacters from t such that the concatenation of the remainingcharacters is s.

Input Specification

The input contains several testcases. Each isspecified by two strings s, t of alphanumeric ASCII characters separatedby whitespace. Input is terminated by EOF.

Output Specification

For each test case output, if s is asubsequence of t.

Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter

SampleOutput

Yes
No
Yes
No

题意:

在字符串2中找字符串1

然后, 其实我不想说思路了

直接贴AC代码:

#include<stdio.h>
#include<string.h> char str1[100005];
char str2[100005]; int main() {
while(scanf("%s %s", str1, str2) != EOF) {
int len1, len2;
len1 = strlen(str1);
len2 = strlen(str2);
int i;
int mark = 0;
int pos = 0;
for(i = 0; i < len2; i++) {
if(str1[pos] == str2[i]) {
pos++;
if(pos >= len1)
mark = 1;
}
}
if(mark)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}

UVA 10340 (13.08.25)的更多相关文章

  1. UVA 10041 (13.08.25)

     Problem C: Vito's family  Background The world-known gangster Vito Deadstone is moving to New York. ...

  2. UVA 639 (13.08.25)

     Don't Get Rooked  In chess, the rook is a piece that can move any number of squaresvertically or ho ...

  3. UVA 10194 (13.08.05)

    :W Problem A: Football (aka Soccer)  The Problem Football the most popular sport in the world (ameri ...

  4. UVA 10499 (13.08.06)

    Problem H The Land of Justice Input: standard input Output: standard output Time Limit: 4 seconds In ...

  5. UVA 253 (13.08.06)

     Cube painting  We have a machine for painting cubes. It is supplied withthree different colors: blu ...

  6. UVA 156 (13.08.04)

     Ananagrams  Most crossword puzzle fans are used to anagrams--groupsof words with the same letters i ...

  7. UVA 573 (13.08.06)

     The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top.The snail can cl ...

  8. UVA 10025 (13.08.06)

     The ? 1 ? 2 ? ... ? n = k problem  Theproblem Given the following formula, one can set operators '+ ...

  9. UVA 465 (13.08.02)

     Overflow  Write a program that reads an expression consisting of twonon-negative integer and an ope ...

随机推荐

  1. JavaEE Tutorials (9) - 运行持久化示例

    9.1order应用118 9.1.1order应用中的实体关系119 9.1.2order应用中的主键121 9.1.3实体映射到多个数据库表125 9.1.4order应用中的层叠操作125 9. ...

  2. Leetcode 动态规划 Unique Paths

    本文为senlie原创.转载请保留此地址:http://blog.csdn.net/zhengsenlie Unique Paths Total Accepted: 17915 Total Submi ...

  3. android经常使用的电话操作

    给大家分享一下我的一个Android工具类,能够获取手机里面的各种信息,包含拨打电话. 获取全部联系人姓名及电话,插入联系人姓名及电话,插入联系人姓名及电话.插入通话记录.获取用户全部短信.批量插入短 ...

  4. Android 建造者(Builder)模式

    关于 Builder 模式 详述:http://blog.csdn.net/jjwwmlp456/article/details/39890699 先来张图 看到 Android  中 使用了 Bui ...

  5. [译]SSRS 编写带参数的MDX报表

    编写MDX报表长久以来对于报表人员来说都比较痛苦. 当然如果你用查询设计器(Query Designer) 直接拖拉数据集那就很方便,但是你们有没有想过查询设计器是怎么创建MDX的.或者创建的参数是如 ...

  6. 基本属性 - iOS中的本地通知

    本地通知的基本使用 创建本地通知 设置属性 调度通知(添加通知到本地通知调度池) 注册用户通知权限(只需一次, 可以单独放在Appdelegate中, 或者别的地方) —> iOS8以后必须, ...

  7. ubuntu中彻底删除nginx

    1.先执行一下命令: 1.1 删除nginx,–purge包括配置文件 sudo apt-get --purge remove nginx 1.2 自动移除全部不使用的软件包 sudo apt-get ...

  8. JavaSE学习总结第04天_Java基础语法3

      04.01 选择结构switch语句的格式及其解释 switch语句的格式: switch(表达式) {    case 值1:语句体1;break;    case 值2:语句体2;break; ...

  9. Web开发在线工具

    JSON: JSON格式化工具 JSON检验并格式化工具 专为Web开发者准备的 63个免费在线工具

  10. 关于sql 中 group by 和 having

    今天看到园里一篇文章(http://www.cnblogs.com/sheldon-lou/p/4881230.html)中面试中有关sql 查询方面的问题, 想想自己从上大学就学习数据库,到后来自己 ...