All in All UVA - 10340
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. Input is terminated by EOF.
Output
For each test case output, if s is a subsequence of t.
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No
HINT
这个题用C++做的,一开始数组开小了,后来开太大了,果断选择string。代码简单,看就好不多解释。
Accepted
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
string s, t;
while (cin >> s >> t)
{
int j = 0;
for (int i = 0;i < t.length(); i++)
if (s[j] == t[i])j++;
cout << (j == s.length() ? "Yes" : "No" )<< endl;
}
return 0;
}
All in All UVA - 10340的更多相关文章
- 贪心水题。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 ...
- UVa 10340 - All in All 水题 难度: 0
题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...
- uva 10340 All in All
水题,从头到尾扫一遍就可以了,输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串s.例如,abcde可以得到bce,但无法得到dc. #include<a ...
- UVA 10340 (13.08.25)
Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memory Limi ...
- UVa 10340 子序列
https://vjudge.net/problem/UVA-10340 题意: 输入两个字符串s和t,判断是否可以从t中删除0个或多个字符得到字符串s. 思路: 很水的题... #include&l ...
- UVa 10340 All in All (水题,匹配)
题意:给定两个字符串,问第一个串能不能从第二个串通过删除0个或多个字符得到. 析:那就一个字符一个字符的匹配,如果匹配上了就往后走,判断最后是不是等于长度即可. 代码如下: #include < ...
- UVA 10340 All in All(字符串,朴素匹配)
#include <stdio.h> #include <algorithm> #include <cstring> using namespace std; ], ...
- 【习题 3-9 UVA - 10340】All in All
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 相当于让你判断s1是不是s2的子序列. for一遍就好 [代码] #include <bits/stdc++.h> us ...
- UVA 10340 - All in All 水~
看题传送门 Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memor ...
随机推荐
- Redis持久化机制 RDB和AOF的区别
一.简单介绍 Redis中的持久化机制是一种当数据库发生宕机.断电.软件崩溃等,数据库中的数据无法再使用或者被破坏的情况下,如何恢复数据的方法. Redis中共有两种持久化机制 RDB(Redis D ...
- Spirent Testcenter二层DHCP绑定流配置
1.OLT配置 配一个VLAN,若GE口打Tag,不需要打PVID,打Untag,配PVID. 在ONU上配一个Other Bridge的WAN连接,并配置VLAN 2.TestCenter配置 选定 ...
- 使用gitlab构建基于docker的持续集成(三)
使用gitlab构建基于docker的持续集成(三) gitlab docker aspnetcore 持续集成 构建发布思路: aspnetcore 下的dockerfile编写 发布docker- ...
- MySQL:安装与配置
记录一次 MySQL 在Windows系统的安装配置过程 安装MySQL 0.下载社区版安装包 官网下载地址:https://dev.mysql.com/downloads/installer/ 1. ...
- mysql添加远程连接权限
查看登录用户 mysql> select host,user,password from user; 想用本地IP登录,那么可以将以上的Host值改为自己的Ip即可. 这里有多个root,对应着 ...
- selenium之元素定位的方法(二)
XPath定位是XML Path的缩写,称为XML路径语言,是在XML文档中查找信息的一种语言,可用来再XML文档中对元素和属性进行搜索.XPath使用路径表达式来选取XML文档中的节点或节点集. X ...
- MVC base64加密的文件,前端下载
后端代码: public FileResult OutPutFile(string base64file,string filename) { buffer = Convert.FromBase64 ...
- swaks制作钓鱼邮件
一.在网站:https://bccto.me/ 申请一个十分钟的邮箱 二.使用命令行,命令行解释如下: --from hacker@qq.com //发件人的邮箱 --ehlo qq.com // ...
- Tomcat8弱口令+后台getshell
漏洞原因 用户权限在conf/tomcat-users.xml文件中配置: <?xml version="1.0" encoding="UTF-8"?&g ...
- 【python】虚拟环境管理之 virtualenv 、pipenv
虚拟环境介绍 应用场景 python在安装第三方包时,会被pip安装到/site-package下,如果我们需要同时维护多个python项目,那这些项目都会共用一个python,而真实需求是多个项目之 ...