All in All - poj 1936 (子串)】的更多相关文章

字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.   #include <iostream> #include <string.h> using namespace std; ]; ]; int main() { while(cin>>s>>t){ int length1=strlen(s); int length2=strlen(t); ,j=; ,j=;i<length1&&j&…
All in All 题目链接:http://poj.org/problem?id=1936 题目大意:判断从字符串s2中能否找到子串s1.字符串长度为10W. Sample Input sequence subsequence person compression VERDI vivaVittorioEmanueleReDiItalia caseDoesMatter CaseDoesMatter Sample Output Yes No Yes No 分析:这明明是模拟题,有人竟然把它归为动态…
题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已匹配A的长度,明显在扫描B的过程中只需要记住cnt这一个状态. 扫描B,每次与A[cnt]匹配就将计数器增加1,cnt与A的长度一致时A就是B的子串. 感想 这道题也许可以用更复杂的方法. 代码 #include <cstdio> #include <cstring> #include…
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 encod…
题目链接:http://poj.org/problem?id=1936 思路分析:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.算法时间复杂度O(N). 代码如下: #include <cstdio> #include <cstring> using namespace std; #define MAX_LEN 100000 + 1 char s[MAX_LEN], t[MAX_LEN]; bool to_find(const…
All in All Time Limit: 1000 MS Memory Limit: 30000 KB 64-bit integer IO format: %I64d , %I64u   Java class name: Main [Submit] [Status] [Discuss] Description You have devised a new encryption technique which encodes a message by inserting between its…
一.Description(3302) Given a string s of length n, a subsequence of it, is defined as another string s' = su1su2...sum where 1 ≤ u1 < u2 < ... < um ≤ n and si is the ith character of s. Your task is to write a program that, given two strings s1 an…
#include<iostream> #include<string> using namespace std; int main() { //freopen("acm.acm","r",stdin); string s1; string s2; int len_1; int len_2; int i; int j; int index; while(cin>>s1>>s2) { // cout<<s1&l…
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 generat…
All in All Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 27537 Accepted: 11274 Description You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way…