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. 如何提取出ppt中的文字?

    最近在看一位老师的教学视频,视频里大部分的知识都记录在ppt里,于是很想将ppt中的文字提取出来,如果我一页一页地粘贴复制的话,效率低到吓人,因为一章的ppt有130多页,于是在网上搜索了一下方法,与 ...

  2. 【视频教程】JEECG 入门视频教程大全+历史版本号代码下载

    <JEECG_v3 入门视频> PPT介绍下载:http://share.csdn.net/slides/4208 ************************************ ...

  3. PeopleEditor的取值及赋值

    /// <summary> /// 从PeopleEditor取值 /// </summary> /// <param name="peopleEditor&q ...

  4. jQuery的AJAX方法简介及与其他文件$符号冲突的解决办法

    一.重要的jQuery AJAX方法简介 $.load(url) 从服务器载入数据 $.get(url,callback) 从服务器请求数据,并执行回调函数 $.post(url,data,callb ...

  5. java中常见的单例模式详解

    很多求职者在面试过程中都被问到了单例模式,最常见的问题,比如,每种单例模式的区别是什么?哪些模式是线程安全的?你们项目里用的哪种单例模式?原来没有注意这个问题,回来赶紧打开项目查看了一下代码,才发现我 ...

  6. 常用类库StringBuilder

    1.使用StringBuilder拼接字符串实例: string[] lines = File.ReadAllLines("sdjk.txt", Encoding.Default) ...

  7. 【原】Spring和Dubbo整合案例和过程

    Dubbo是Alibaba开源的分布式服务框架,它最大的特点是按照分层的方式来架构,使用这种方式可以使各个层之间解耦合(或者最大限度地松耦合).从服务模型的角度来看,Dubbo采用的是一种非常简单的模 ...

  8. new[] class deconstructor

    Class class(); Class *class1=new class; class1=&class; delete class1;   // Assert 指针指向的是一个栈中的对象, ...

  9. git配合tortoiseGit的基础使用

    转载自:http://www.cnblogs.com/ssor/archive/2012/02/04/2337823.html 一定要自己写出来才能牢记,所以我来写一下 git确实比svn好用的多了, ...

  10. IE11中[if lt IE 9]兼容性问题

    IE11不支持<!--[if lt IE 9]>  <![endif]--> ,蛋疼的IE!!!