看题传送门

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 oft, i.e. if you can removecharacters fromt such that the concatenation of the remainingcharacters iss.

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


题解:


水题哇~直接扫描一遍数组就好了,出现RE的话把数组开大就好了~

代码:

#include<cstdio>
#include<cstring>
const int MAXN=500000;
char a[MAXN],b[MAXN];
int main()
{
while(scanf("%s%s",b,a)!=EOF)
{
int lena,lenb;
lena=strlen(a);
lenb=strlen(b);
bool ok=true;
int i=0,j=0;
for(;i<lena&&j<lenb;i++)
if(a[i]==b[j])
j++;
if(j!=lenb)
ok=false;
printf("%s\n",ok==true?"Yes":"No");
}
}

UVA 10340 - All in All 水~的更多相关文章

  1. UVa 10340 - All in All 水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  2. 贪心水题。UVA 11636 Hello World,LA 3602 DNA Consensus String,UVA 10970 Big Chocolate,UVA 10340 All in All,UVA 11039 Building Designing

    UVA 11636 Hello World 二的幂答案就是二进制长度减1,不是二的幂答案就是是二进制长度. #include<cstdio> int main() { ; ){ ; ) r ...

  3. UVa 10340 All in All (水题,匹配)

    题意:给定两个字符串,问第一个串能不能从第二个串通过删除0个或多个字符得到. 析:那就一个字符一个字符的匹配,如果匹配上了就往后走,判断最后是不是等于长度即可. 代码如下: #include < ...

  4. uva 10340 All in All

    水题,从头到尾扫一遍就可以了,输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串s.例如,abcde可以得到bce,但无法得到dc. #include<a ...

  5. uva 10252 - Common Permutation 字符串水题

    题意:給定兩個小寫的字串a與b,請印出皆出現在兩字串中的字母,出現的字母由a~z的順序印出,若同字母出現不只一次,請重複印出但不能超過任一字串中出現的次數.(from Ruby兔) 很水,直接比较输出 ...

  6. uva 489 Hangman Judge(水题)

    题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&am ...

  7. UVa 10340 子序列

    https://vjudge.net/problem/UVA-10340 题意: 输入两个字符串s和t,判断是否可以从t中删除0个或多个字符得到字符串s. 思路: 很水的题... #include&l ...

  8. UVa 11636 Hello World! (水题思维)

    题意:给你一个数,让你求需要复制粘贴多少次才能达到这个数. 析:这真是一个水题,相当水,很容易知道每次都翻倍,只要大于等于给定的数就ok了. 代码如下: #include <iostream&g ...

  9. UVA 11947 Cancer or Scorpio 水题

    Cancer or Scorpio Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://uva.onlinejudge.org/index.php? ...

随机推荐

  1. js---11闭包

    //匿名立即调用函数 (function(){//把a,b,f全部隐藏在函数中,外部访问不到, var a = 5; var b = 6; function f(){ alert(a); } wind ...

  2. 详解Android插件化开发-资源访问

    动态加载技术(也叫插件化技术),当项目越来越庞大的时候,我们通过插件化开发不仅可以减轻应用的内存和CPU占用,还可以实现热插拔,即在不发布新版本的情况下更新某些模块.     通常我们把安卓资源文件制 ...

  3. 洛谷P2115 [USACO14MAR]破坏Sabotage

    题目描述 Farmer John's arch-nemesis, Farmer Paul, has decided to sabotage Farmer John's milking equipmen ...

  4. syslog日志介绍

    一. syslog简介 syslog是一种工业标准的协议,可用来记录设备的日志.在UNIX系统,路由器.交换机等网络设备中,系统日志(System Log)记录系统中任何时间发生的大小事件.管理者可以 ...

  5. 004 python 流程控制语句

    流程控制语句 1.if判断 语法 a = 10,b = 20# 1if a == 10:  print('a等于10')# 2if a > b:  print('a大于b')else:  pri ...

  6. 使用TCP协议的NAT穿透技术 (转载)

    其实很早我就已经实现了使用TCP协议穿透NAT了,但是苦于一直没有时间,所以没有写出来,现在终于放假有一点空闲,于是写出来共享之. 一直以来,说起NAT穿透,很多人都会被告知使用UDP打孔这个技术,基 ...

  7. js16--自定义原型对象

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...

  8. sql server存储过程调用C#编写的DLL文件

    新建C#类库,编译. 引用 using Microsoft.SqlServer.Server; 方法 [SqlFunction]public static int GenerateTxt(){ ... ...

  9. Linux下搭建JSP环境

    Linux下搭建JSP环境     作为一名Java EE系统架构工程师,经常需要搭配和建立JSP(Java Server Pages)的开发环境和运行环境,所以本人在平时的工作中积累了一些在Linu ...

  10. Android 打造属于自己的RxBus

    RxBus 通过RxJava实现Rxbus. 相信大家已经非常熟悉EventBus了.最近正在学习Rxjava,如果在项目中已经使用了Rxjava,使用RxBus来代替EventBus应该是不错的选择 ...