UVa 10340 子序列
https://vjudge.net/problem/UVA-10340
题意:
输入两个字符串s和t,判断是否可以从t中删除0个或多个字符得到字符串s。
思路:
很水的题...
#include<iostream>
#include<string>
#include<cstring>
using namespace std; string s, t; int main()
{
//freopen("D:\\txt.txt", "r", stdin);
while (cin >> s >> t)
{
int l1 = s.size();
int l2 = t.size();
int p1 = , p2 = ;
while (p1 < l1 && p2 < l2)
{
if (s[p1] == t[p2])
{
p1++;
p2++;
}
else
p2++;
}
if (p1 == l1) cout << "Yes" << endl;
else cout << "No" << endl;
}
}
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 ...
- 【习题 3-9 UVA - 10340】All in All
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 相当于让你判断s1是不是s2的子序列. for一遍就好 [代码] #include <bits/stdc++.h> us ...
- 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 All in All (水题,匹配)
题意:给定两个字符串,问第一个串能不能从第二个串通过删除0个或多个字符得到. 析:那就一个字符一个字符的匹配,如果匹配上了就往后走,判断最后是不是等于长度即可. 代码如下: #include < ...
- UVA 10340 All in All(字符串,朴素匹配)
#include <stdio.h> #include <algorithm> #include <cstring> using namespace std; ], ...
- UVA 10340 - All in All 水~
看题传送门 Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memor ...
- All in All UVA - 10340
You have devised a new encryption technique which encodes a message by inserting between its charac ...
随机推荐
- vue-preview使用
1.安装 npm i vue-preview -S2.如果使用vue-cli生成的项目,需要修改webpack.base.conf.js文件中的loaders,添加一个loader{ test:/vu ...
- Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of
eclipse在build maven项目的时候报错, 原来是Windows------->preference----->maven----------->usesettings配 ...
- 【Cocos2dx 3.3 Lua】剪裁结点ClippingNode
参考资料: http://shahdza.blog.51cto.com/2410787/1561937 http://blog.csdn.net/jackystudio/article/det ...
- centos7最小安装初始化脚本
#!/bin/bash #zhangsen #lovexlzs@qq.com if [[ "$(whoami)" != "root" ]]; then exit ...
- ComBSTR的使用
用 CComBSTR 进行编程 Visual Studio .NET 2003 3(共 3)对本文的评价是有帮助 - 评价此主题 ATL 类 CComBSTR 提供对 BSTR 数据类型的包装 ...
- 主成分分析(PCA)算法,K-L变换 角度
主成分分析(PCA)是多元统计分析中用来分析数据的一种方法,它是用一种较少数 量的特征对样本进行描述以达到降低特征空间维数的方法,它的本质实际上是K-L变换.PCA方法最著名的应用应该是在人脸识别中特 ...
- 对于session,request,cookie的理解
session和request的生命周期 首先是session,比如我们在实现一个购物车功能时,在某一页面(这里称为页面A)选择了一些购物的商品,添加到购物车.那么当我们选择完成后点击我的购物车时会跳 ...
- css+table
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- REST服务安全-双向认证
1. 创建服务器密钥,其密钥库为 d:/mykeys/server.ks,注意keypass和storepass保持一致,它们分别代表 密钥密码和密钥库密码,注意 CN=localhost 中,loc ...
- SVN Error: Unreadable path encountered; access denied;
最近在公司弄了版本库.将主代码丢到版本库后,想拉取新的分支.抛异常如下: SVN Error: Unreadable path encountered; access denied; 解决办法: 1. ...