uva 10340 All in All
水题,从头到尾扫一遍就可以了,输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串s。例如,abcde可以得到bce,但无法得到dc。
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<iostream>
#define len 101000 using namespace std; char s[len], t[len]; int main()
{
int sn, tn, ls, lt;
while (cin >> s) {
cin >> t;
ls = strlen(s);
lt = strlen(t);
sn = ;tn = ;
for (int i = ;i < ls, i < lt;i++) {
if (s[sn] == t[tn]) {
sn++;
tn++;
}
else {
tn++;
}
}
if (sn == ls)cout << "Yes" << endl;
else cout << "No" << endl;
}
return ;
}
uva 10340 All in All的更多相关文章
- 贪心水题。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 (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 ...
- All in All UVA - 10340
You have devised a new encryption technique which encodes a message by inserting between its charac ...
随机推荐
- plist文件真机写入方法
http://blog.csdn.net/mydo/article/details/50290219 转 但是这对真机不管用,因为在真机环境下,App在Xcode中的Resources文件夹都是不可 ...
- a few changes of Android 5.0
1.Service Intent must be explicit Intent serviceIntent = new Intent(context,MyService.class);context ...
- Android FM模块学习之四源码分析(3)
接着看FM模块的其他几个次要的类的源码.这样来看FM上层的东西不是太多. 请看android\vendor\qcom\opensource\fm\fmapp2\src\com\caf\fmradio\ ...
- ARM compiler No such file or directory
/********************************************************************************* * ARM compiler No ...
- 启动运行下载gradle速度太慢,手动添加
启动运行下载gradle速度太慢,并且容易卡死(感谢群友ˋ狠ㄨ得意提供支持)---国内网络访问地址 我们经常运行项目的时候会需要进行下载gradle,不过由于网络或者和谐的问题经常下载需要花很长时间或 ...
- jq获取当前点击的li是ul中的第几个?
<script> var navulsize = $('.navul li').size(); var navulwidth = $('.navul li').wid ...
- POJ-1743 Musical Theme(后缀数组)
题目大意:给一个整数序列,找出最长的连续变化相同的.至少出现两次并且不相重叠一个子序列. 题目分析:二分枚举长度进行判定. 代码如下: # include<iostream> # incl ...
- C#访问非托管内存
示例1:分配一个新的内存地址给新变量 Point p; // Initialize unmanged memory to hold the struct. IntPtr pnt = Marshal.A ...
- Embedded database support
http://docs.spring.io/spring-framework/docs/3.0.0.M4/reference/html/ch12s08.html <jdbc:embedd ...
- NSIS使用记录
; 该脚本使用 HM VNISEdit 脚本编辑器向导产生 ; 安装程序初始定义常量 !define PRODUCT_NAME "" !define PRODUCT_VERSION ...