uva10340 Ail in All

简介: 题意:输入两个字符串s和t,判断是否可以从t种删除0个或多个字符(其他字符不变),得到字符串s,比如abcde可以得到bce,单数无法得到dc 分析:简单模拟即可 1 #include 2 #include 3 #include 4 #define zz 5 usin...

题意:输入两个字符串s和t,判断是否可以从t种删除0个或多个字符(其他字符不变),得到字符串s,比如abcde可以得到bce,单数无法得到dc

分析:简单模拟即可

 1 #include <stdio.h>
 2 #include <iostream>
 3 #include <string>
 4 #define zz
 5 using namespace std;
 6 int main(){
 7 #ifndef zz
 8     freopen("in.txt", "r", stdin);
 9 #endif
10     string s, t;
11     while(cin>>s>>t){
12         int i=0, j=0;
13         while(i<s.length() && j<t.length()){
14             if(s[i]==t[j]){
15                 i++;
16                 j++;
17             }
18             else{
19                 j++;
20             }
21         }
22         if(i==s.length()) puts("Yes");
23         else puts("No");
24     }
25 }

 

目录
相关文章
|
9月前
uva10038 Jolly Jumpers
uva10038 Jolly Jumpers
24 0
|
9月前
UVa10123 No Tipping
UVa10123 No Tipping
41 0
|
9月前
UVa11776 - Oh Your Royal Greediness!
UVa11776 - Oh Your Royal Greediness!
39 0
UVa 10082 WERTYU
Problem Description A common typing error is to place the hands on the keyboard one row to the right of the correct position.
864 0
概率dp - UVA 11021 Tribles
Tribles  Problem's Link:  http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=33059   Mean:  有k个细菌,每个细菌只能存活一天,在死去之前可能会分裂出0,1,2....n-1个细菌,对应的概率为p0,p1,p2....pn-1。
799 0
|
C++
UVA 之10010 - Where's Waldorf?
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SunnyYoona/article/details/24863879 ...
688 0
|
人工智能
uva 305 Joseph
点击打开链接uva 305 思路: 数学+打表 分析: 1 传统的约瑟夫问题是给定n个人和m,每次数m次把当前这个人踢出局,问最后留下的一个人的编号 2 这一题是前k个人是好人,后面k个是坏人。
1019 0
|
C++
uva 11136 Hoax or what
点击打开链接uva 11136 思路: STL 分析: 1 题目意思比较不好理解,理解了题目之后我们可以利用STL的multiset来做 2 每次找到最大和最小的值,然后求解即可 代码: #include #include #in...
828 0