OpenJudge/Poj 1936 All in All
1.链接地址:
http://poj.org/problem?id=1936
http://bailian.openjudge.cn/practice/1936
2.题目:
All in All
Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 26651 Accepted: 10862 Description
You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.Given two strings s and t, you have to decide whether s is a
subsequence of t, i.e. if you can remove characters from t such that the
concatenation of the remaining characters is s.Input
The
input contains several testcases. Each is specified by two strings s, t
of alphanumeric ASCII characters separated by whitespace.The length of s
and t will no more than 100000.Output
For each test case output "Yes", if s is a subsequence of t,otherwise output "No".Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatterSample Output
Yes
No
Yes
NoSource
3.思路:
4.代码:
#include "stdio.h"
//#include "stdlib.h"
#include "string.h"
#define NUM 100002
char s[NUM],t[NUM];
int main()
{
int i,j;
int len_s,len_t;
while(scanf("%s%s",s,t) != EOF)
{
len_s=strlen(s);
len_t=strlen(t);
i=;j=;
while(i<len_s && j<len_t)
{
if(s[i]==t[j]) i++;
j++;
}
//printf("%s%s\n",s,t);
if(i>=len_s) printf("Yes\n");
else printf("No\n");
}
//system("pause");
return ;
}
OpenJudge/Poj 1936 All in All的更多相关文章
- OpenJudge / Poj 2141 Message Decowding
1.链接地址: http://poj.org/problem?id=2141 http://bailian.openjudge.cn/practice/2141/ 2.题目: Message Deco ...
- OpenJudge/Poj 2105 IP Address
1.链接地址: http://poj.org/problem?id=2105 http://bailian.openjudge.cn/practice/2105 2.题目: IP Address Ti ...
- OpenJudge/Poj 2027 No Brainer
1.链接地址: http://bailian.openjudge.cn/practice/2027 http://poj.org/problem?id=2027 2.题目: 总Time Limit: ...
- OpenJudge/Poj 2013 Symmetric Order
1.链接地址: http://bailian.openjudge.cn/practice/2013 http://poj.org/problem?id=2013 2.题目: Symmetric Ord ...
- OpenJudge/Poj 1088 滑雪
1.链接地址: bailian.openjudge.cn/practice/1088 http://poj.org/problem?id=1088 2.题目: 总Time Limit: 1000ms ...
- OpenJudge/Poj 2001 Shortest Prefixes
1.链接地址: http://bailian.openjudge.cn/practice/2001 http://poj.org/problem?id=2001 2.题目: Shortest Pref ...
- OpenJudge/Poj 2000 Gold Coins
1.链接地址: http://bailian.openjudge.cn/practice/2000 http://poj.org/problem?id=2000 2.题目: 总Time Limit: ...
- OpenJudge/Poj 1661 帮助 Jimmy
1.链接地址: bailian.openjudge.cn/practice/1661 http://poj.org/problem?id=1661 2.题目: 总Time Limit: 1000ms ...
- OpenJudge/Poj 1915 Knight Moves
1.链接地址: http://bailian.openjudge.cn/practice/1915 http://poj.org/problem?id=1915 2.题目: 总Time Limit: ...
随机推荐
- 修改cas登陆页面-服务器端
原文地址:http://www.cnblogs.com/liveandevil/archive/2013/03/06/2946341.html 1.cas统一认证的登陆页面位于:cas目录/WEB-I ...
- C#实现在Winform中嵌入Word和Excel
http://www.cnblogs.com/wuzi145/archive/2012/05/08/2490680.html 在此只是介绍一个简单控件:dsoframer.ocx的使用,这个控件需要通 ...
- OpenCV快速遍历矩阵元素方法
OpenCV中Mat矩阵data数据的存储方式和二维数组不一致,二维数组按照行优先的顺序依次存储,而Mat中还有一个标示行步进的变量Step.使用Mat.ptr<DataTyte>(row ...
- C# 网络编程之豆瓣OAuth2.0认证具体解释和遇到的各种问题及解决
近期在帮人弄一个豆瓣API应用,在豆瓣的OAuth2.0认证过程中遇到了各种问题,同一时候自己须要一个个的尝试与解决,终于完毕了豆瓣API的訪问.作者这里就不再吐槽豆瓣的认证文档了,毕 ...
- iOS使用宏写单例
本文只介绍ARC情况下的单例 过去一直背不下来单例如何写,就是知道这么回事,也知道通过宏来写单例,但是一直记不住,今天就来记录一下 - (void)viewDidLoad { [super v ...
- NDK设置C++编译器版本号
背景及问题: 小僧在使用VS2010写C++写Cocos2d-x 2.2.1的版本号的时候不小心使用了C++11的语法,怎料移植android版本号的时候编译失败(编译环境:ADT+NDK),例如以 ...
- Understanding transient variables in Java and how they are practically used in HashMap---reference
What is the significance of the transient keyword in Java? If you know the answer, good! you are a p ...
- 在aws ec2上使用root用户登录
aws ec2默认是使用ec2-user账号登陆的,对很多文件夹是没有权限的.如何使用root账号执行命令就是一个问题了.解决办法如下: 1.根据官网提供的方法登录连接到EC2服务器(官网推荐wind ...
- about semget
flags must include read,write,execute permission. for examples: semget( 3333, 1, IPC_CREAT | IPC_EXC ...
- 使用SDWebImage 怎么获取指定请求对应的缓存图片呢?
SDWebImage会对我们加载的网络数据进行缓存,但有时候我们想要拿到缓存数据中的图片,可以通过下个方法实现: UIImage *thumbnailImage = [[SDImageCache sh ...