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. HDU 3625 Examining the Rooms

    题目大意:有n个房间,n!个钥匙,在房间中,最多可以破k扇门,然后得到其中的钥匙,去开其它的门,但是第一扇门不可以破开,求可以打开所有门的概率. 题解:首先,建立这样的一个模型,题目相当于给出一个图, ...

  2. 【数位dp】【HDU 3555】【HDU 2089】数位DP入门题

    [HDU  3555]原题直通车: 代码: // 31MS 900K 909 B G++ #include<iostream> #include<cstdio> #includ ...

  3. [Django实战] 第8篇 - 分页列表

    当用户登录成功后,首先看到的是他自己之前提交的任务列表,本篇将实现该页面. 视图(views.py)里定义如下: from django.core.paginator import Paginator ...

  4. lightoj Again Array Queries

    1100 - Again Array Queries   PDF (English) Statistics Forum Time Limit: 3 second(s) Memory Limit: 32 ...

  5. Linux相关问题-CentOS6.5 x64版本号下Tomcat无法自启动的解决的方法

    前段时间使用阿里云server.使用的是Linux CentOS6.5系统,在搭建完Tomcat后发现,Tomcat无法自启动. 将启动tomcat的命令为tomcat_home/bin/startu ...

  6. .net EF中从数据添加表或视图时无法添加的问题

    .net 使用EF模式进行开发,添加实体时不能够正常添加 错误描述: .net中在EF文件中添加数据库中已有的表或视图时不能正常添加,在添加时没有任何的错误提示,但是表或视图就一直拉不过来,,保存也没 ...

  7. 找出N^N的最左边的一位数和最后边的一位数

    问题:找出N^N的最左边的一位数和最右边的一个数,N(1<=N<=1,000,000,000). 找最右边一位: 分析:其实找左右边的一位数还挺简单的,快速幂每次都只取结果的最后一位参加下 ...

  8. Laravel 5.1 ACL权限控制 二 之策略类

    随着应用逻辑越来越复杂,要处理的权限越来越多,将所有权限定义在AuthServiceProvider显然不是一个明智的做法,因此Laravel引入了策略类,策略类是一些原生的PHP类,和控制器基于资源 ...

  9. ARPU_百度百科

    ARPU_百度百科 ARPU

  10. UVA 10341 Solve It 解方程 二分查找+精度

    题意:给出一个式子以及里面的常量,求出范围为[0,1]的解,精度要求为小数点后4为. 二分暴力查找即可. e^(-n)可以用math.h里面的exp(-n)表示. 代码:(uva该题我老是出现Subm ...