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 ...
随机推荐
- 2016-06-06:X264码率控制
H.264与x264 H264是一个视频压缩编码标准.https://zh.wikipedia.org/wiki/H.264/MPEG-4_AVC X264实现H264视频压缩标准的开源项目.http ...
- 使用 Intellij Idea 导出JavaDoc
使用/* ...... /来注释代码,解释方法参数,返回参数,类的功能及用法. 常用的注释标签: @author 作者 @version 版本 @see 参考转向 @param 参数说明 @retur ...
- 用asp.net c# HttpWebRequest获取网页源代码
public string GetPage(string url) { HttpWebRequest request = null; HttpWebResponse response = null; ...
- Python自动化 【第八篇】:Python基础-Socket编程进阶
本节内容: Socket语法及相关 SocketServer实现多并发 1. Socket语法及相关 sk = socket.socket(socket.AF_INET,socket.SOCK_STR ...
- iOS 原生态扫描二维码、条形码的功能。
1.导入AVFoundatin.framework. 2.新建一个viewController,命名为QRScanViewController,用于扫描的界面. h文件如下,设置代理. #import ...
- delphi Inc函数和Dec函数的用法
inc自增函数 .inc(i,n)://i,n:integer;n为自增量 相当于i:=i+n: .inc(i)://i:integer; 相当于i:=i+; dec自减函数 .dec(i,n): ...
- {Reship}{C#}{GDI+}GDI+画笔,线,区域类型
=================================================================================== This article is ...
- 记录今天学习python中for与while循环针对break和continue的用法
python中有两个主要的循环for与while,其中针对这两个循环有两种不同的中断用法break与continue. 首先先看下面的循环代码: 1: for i in range(10):#变量i带 ...
- .net该的帐
1.web api 2.socket通信 3.NUnit单元测试 4.了解自动化测试各种工具
- Intel 82599 万兆网卡
http://www.cnblogs.com/zhuyp1015/archive/2012/08/23/2653264.html http://bbs.chinaunix.net/thread-424 ...