All in All
2016-02-03 20:25
288 查看
题意:
判断给出的序列是不是后一个的子序列
思路:
逐位比较
代码:
判断给出的序列是不是后一个的子序列
思路:
逐位比较
代码:
#include<cstdio> #include<cstring> #include<string> #include<iostream> using namespace std; string a, b; int main() { while(cin>>a>>b) { int asize = a.size(); int bsize = b.size(); if(asize > bsize) { printf("No\n"); continue; } int j=0; for(int i=0; i<bsize; i++){ if(a[j] == b[i]) j++; } if(j == asize) printf("Yes\n"); else printf("No\n"); } return 0; }
相关文章推荐
- DelphiXE8怎么使用调试模式(朱建强)
- switchover步骤切换
- HDU1301 并查集和最小生成树
- Spring+Struts2+Hibernate+Apache POI 实现的Excel2007导入导出功能代码分享
- 【BZOJ3152】组合子逻辑,贪心+堆
- Hibernate框架由myeclipse自动生成遇到的问题
- 最大公约数(gcd)和 最小公倍数(lcm)——辗转相除法
- Children's Game
- Python+Django+SAE系列教程15-----输出非HTML内容(图片/PDF)
- linux命令学习
- 共享一个ubuntu64位中打包好的Xware Desktop(linux版迅雷下载)(深度和ubuntu14以上的版本都可用)
- 聊天机器人--C语言(非智能+初级简单)
- C++静态库中使用_declspec(dllexport) 不能导出函数的问题
- Vmware win虚拟机无法上网
- 32位程序在64位系统上获取系统安装时间(要使用KEY_WOW64_64KEY标记)
- HTTP1.1协议中文版-RFC2616
- Linux防火墙配置(iptables, firewalld)
- iframe上传图片
- poj--1679
- The Trip, 2007