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 ...
随机推荐
- Linuxer-"Linux开发人员自己的媒体"第五月稿件和赠书名单
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/juS3Ve/article/details/78859630 Linuxer已经从一个单纯的读者服务 ...
- Scala集合类详解
对scala中的集合类虽然有使用,但是一直处于一知半解的状态.尤其是与java中各种集合类的混合使用,虽然用过很多次,但是一直也没有做比较深入的了解与分析.正好趁着最近项目的需要,加上稍微有点时间,特 ...
- hdu1671Phone List(字典树)
#include <iostream> #include <stdio.h> #include <string.h> #include <stdlib.h&g ...
- [LeetCode] 53. Maximum Subarray_Easy tag: Dynamic Programming
Given an integer array nums, find the contiguous subarray (containing at least one number) which has ...
- c++四种强制类型转化
c++ 数据类型转换: static_cast dynamic_cast reinterpret_cast const_cast C++ 类型转换(C风格的强制转换): (1)将浮点型数据赋值给整型变 ...
- 多项式函数插值:多项式形式函数求值的Horner嵌套算法
设代数式序列 $q_1(t), q_2(t), ..., q_{n-1}(t)$ ,由它们生成的多项式形式的表达式(不一定是多项式): $$p(t)=x_1+x_2q_1(t)+...x_nq_1(t ...
- 认识GMT和UTC时间-附带地理知识
GMT-格林尼治标准时 GMT 的全名是格林威治标准时间或格林威治平时 (Greenwich Mean Time),这个时间系统的概念在 1884 年确立,由英国伦敦的格林威治皇家天文台计算并维护,并 ...
- jq table页二级联动
<div class="layerRtb layerRtb-threecolumn"> <div class="clearfix layerRtb-he ...
- 新版.Net开发必备十大工具(转)
Snippet Compiler Snippet Compiler是一个基于 Windows 的小型应用程序,你可以通过它来编写.编译和运行代码.如果你具有较小的代码段,并且你不想创建完整的 Visu ...
- Linux基础命令---chmod
chmod 改变文件或者目录的权限,可以用数字或者字母来标识权限.在数字模式下:0,代表没有权限:1,代表可执行:2,代表可读:4,代表可写:多个权限可以相加.在字符模式下:x,代表执行:r,代表读: ...