[编程题] 藏宝图
来源:互联网 发布:2017年网络热点话题 编辑:程序博客网 时间:2024/06/08 17:04
题目描述
牛牛拿到了一个藏宝图,顺着藏宝图的指示,牛牛发现了一个藏宝盒,藏宝盒上有一个机关,机关每次会显示两个字符串 s 和 t,根据古老的传说,牛牛需要每次都回答 t 是否是 s 的子序列。注意,子序列不要求在原字符串中是连续的,例如串 abc,它的子序列就有 {空串, a, b, c, ab, ac, bc, abc} 8 种。
输入描述:
每个输入包含一个测试用例。每个测试用例包含两行长度不超过 10 的不包含空格的可见 ASCII 字符串。
输出描述:
输出一行 “Yes” 或者 “No” 表示结果。
示例1
输入
x.nowcoder.comooo
输出
Yes
#include <iostream>#include <stdlib.h>#include <string.h>#include <stdio.h>#include <queue>#include <algorithm>#include <cstring>#include <stack>using namespace std;typedef long long ll;char a[1100];char b[100];int main(){ cin>>a; cin>>b; int now=0; int get=0; for(int i=0;a[i];i++) { if(a[i]==b[now]) now++; } if(now==strlen(b)) cout<<"Yes"<<endl; else cout<<"No"<<endl;}
阅读全文
0 0
- 《网易编程题》藏宝图
- [编程题] 藏宝图
- [编程题] 藏宝图
- 编程题
- 编程题
- 编程题?
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 图论 -Tarjan算法
- java项目乱码处理
- Monkey的APK集合测试的设置方法
- bzoj1493
- 一个简单的压缩成tar.gz文件的shell脚本
- [编程题] 藏宝图
- 6.4
- 指针问题梳理
- git问题:You have not concluded your merge (MERGE_HEAD exists)
- java反射与代理
- Mac安装OpenCV(用于虚拟环境)
- Ubuntu14.04下编译pycaffe并绘制网络结构图
- 中国计算机学会推荐国际学术期刊
- 11月9日心得