poj 1936 All in All
All in All
Time Limit: 1000 MS Memory Limit: 30000 KB
64-bit integer IO format: %I64d , %I64u Java class name: Main
Description
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
Output
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No 题意:第一个串是否是第二个的子串 区分大小写 依旧前几道题暴力的思想
#include <iostream>
#include <string.h>
#include <stdio.h> using namespace std; int main()
{
long long int i,j; ///int会超
char s1[],s2[];
while(scanf("%s",s1)!=EOF)
{
scanf("%s",s2);
long len1=strlen(s1);
long len2=strlen(s2);
i=;
j=;
while(true)
{
if(i==len1)
{
cout<<"Yes"<<endl;
break;
}
else if(i<len1 && j==len2)
{
cout<<"No"<<endl;
break;
}
if(s1[i]==s2[j])
{
i++;
j++;
}
else
j++;
}
memset(s1,'\0',sizeof(s1));
memset(s2,'\0',sizeof(s2));
}
return ;
}
poj 1936 All in All的更多相关文章
- OpenJudge/Poj 1936 All in All
1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...
- POJ 1936 All in All(模拟)
All in All 题目链接:http://poj.org/problem?id=1936 题目大意:判断从字符串s2中能否找到子串s1.字符串长度为10W. Sample Input sequen ...
- poj 1936 All in All(水题)
题目链接:http://poj.org/problem?id=1936 思路分析:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.算法时间复杂度O ...
- POJ 1936 All in All 匹配, 水题 难度:0
题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已 ...
- Poj 1936,3302 Subsequence(LCS)
一.Description(3302) Given a string s of length n, a subsequence of it, is defined as another string ...
- POJ 1936
#include<iostream> #include<string> using namespace std; int main() { //freopen("ac ...
- 简单的字符串比较题 POJ 1936
Description You have devised a new encryption technique which encodes a message by inserting between ...
- All in All - poj 1936 (子串)
字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断. #include <iostream> #include <string. ...
- POJ 1936 All in All(串)
All in All Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 27537 Accepted: 11274 Descript ...
随机推荐
- dedecms代码研究五
上一次留几个疑问: 1)DedeTagParse类LoadTemplet方法. 2)MakeOneTag到底在搞什么. 从DedeTagParse开始前面,我们一直在dedecms的外围,被各种全局变 ...
- Flask——route
Flask——route 关于路由flask中有三种方法(例子)处理: flask.Flask.route 装饰器(关于装饰器可以参考该文),这时最常见的使用方法,在装饰器的参数中加入想要的路由即可, ...
- java学习第四天
那些逻辑语言就基本了解下,今天想到了一个问题就是关于for和while的区别,从专业上来说,for和while基本上是相同的,但是for是只允许一次访问的,如果结束后就无法继续访问,而while则可以 ...
- tomcat的乱码问题
String filename=request.getParameter("filename"); filename=new String(filename.getBytes(&q ...
- 【浅析】IMU代码
IMU的代码的引自https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/imumargalgo ...
- HP XP7 GAD双活实现的理解
XP7双活的虚拟卷global active device (GAD)实际上对应两个存储的两个物理卷(有点儿像Mirror Disk镜像) 当主机A向阵列A发出写数据请求后,阵列A首先检查要被写入的数 ...
- XidianOJ 1096 数的拆分
题目描述 输入自然数n,然后将其拆分成由若干数相加的形式,参与加法运算的数可以重复. 输入 多组数据.每组只有一个整数n,表示待拆分的自然数n. n<=80 输出 每组一个数,即所有方案数. - ...
- c# & Fizzler to crawl web page in a certain website domain
使用fizzler [HtmlAgilityPackExtension]和c#进行网页数据提取:fizzler是HtmlAgilityPack的一个扩展,支持jQuery Selector: 提取数据 ...
- android前端开发 布局学习
元素背景设置 -------------------------------- Android中shape中的属性大全 http://www.oschina.net/question/166763_3 ...
- dmesg
在开机的时候你会发现有很多的讯息出现吧,例如 CPU 的形式.硬盘. 光盘型号及硬盘分割表等等,这 些信息的产生都是核心 (kernel) 在进行硬件的测试与驱动啦.要看这些讯息你可以用 dmesg ...