码迷,mamicode.com
首页 >  
搜索关键字:子串    ( 5576个结果
Partitioning by Palindromes
uva11584:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2631题意:给你一个串,问你这个串最少被划分成多少个子串,才能使得每个子串都是回文子串。题...
分类:其他好文   时间:2014-07-03 21:52:42    阅读次数:237
[算法]求一段包含所有种类的字符子串
有一个字符串首尾相连(m个字符),有n种字符组成,求一段能使包含n种字符的子串,并使长短最短,时间复杂度要求O(n),空间复杂度O(1)#include int foo(const char* str, int m, int n){ int hit[256], count = 0, begin...
分类:其他好文   时间:2014-07-03 20:28:46    阅读次数:312
CodeForces 25E Test KMP
题目链接:点击打开链接 题意: 给定3个字符串,进行拼接 重复的一段可以覆盖,问拼接后最小的长度(若一个串s1是s2的子串,则s1可以认为嵌入了s2内,不需要进行拼接 思路: kmp搞一下。 #include #include #include #include #include #include using namespace std; #define N 300005 ...
分类:其他好文   时间:2014-07-03 18:34:24    阅读次数:215
SPOJ 220 Relevant Phrases of Annihilation (后缀数组)
题目大意: 求在m个串中同时出现两次以上且不覆盖的子串的长度。 思路分析: 二分答案,然后check是否满足,判断不覆盖的方法就是用up down 来处理边界。 #include #include #include #include #include #include #define maxn 110005 using namespace std; char ...
分类:其他好文   时间:2014-07-03 16:55:30    阅读次数:350
leetcode-Longest Substring Without Repeating Characters 最长不重复子串
在一个字符串中求不重复子串的最大长度是一个经典的贪心法求解问题(说子串自然是连续的,子序列则不要求连续)。 先给出leetcode上这题的描述: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring wit...
分类:其他好文   时间:2014-07-03 16:24:55    阅读次数:281
字符串-02. 删除字符串中的子串(20)
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 string s1, s2; 6 getline(cin, s1); 7 getline(cin, s2); 8 while(s1.find(s...
分类:其他好文   时间:2014-07-02 17:17:29    阅读次数:281
poj 1743 最长不重叠重复子串 后缀数组+lcp+二分
题比较容易读懂,但是建模需动点脑子: 一个子串加常数形成的子串认为跟子串相同,求最长不重叠重复子串 题目中说 is disjoint from (i.e., non-overlapping with) at least one of its other appearance(s) 意味着不能重叠,举个例子 1, 2,3,  52, 53,54 1,2, 3和 52, 5...
分类:其他好文   时间:2014-07-02 15:15:01    阅读次数:289
UVA 12718 Dromicpalin Substrings(寻找字符串连续子串的回文)
UVA 12718 Dromicpalin Substrings(寻找字符串连续子串的回文)...
分类:其他好文   时间:2014-07-02 09:45:05    阅读次数:214
POJ 3261 Milk Patterns(后缀数组)
题目大意: 求可覆盖的出现k次的子串的最大长度。 思路分析: 同样是二分答案的长度,然后扫描height判断是否成立。 #include #include #include #include #define maxn 1000005 using namespace std; int str[maxn]; int sa[maxn],t1[maxn],t2[maxn]...
分类:其他好文   时间:2014-07-02 09:02:19    阅读次数:258
SPOJ 694、705 Distinct Substrings 、 New Distinct Substrings (后缀数组)
题目大意: 求串中不同的子串的个数。 思路分析: 子串一定是某一个后缀的前缀。 所以我们把每一个后缀拿出来,分析它有多少个前缀,然后除去它与sa数组中前面那个后缀相同的前缀。 最后也就是 ans = segma (n-sa[i] + height[i]).... #include #include #include #include #define maxn 1...
分类:其他好文   时间:2014-07-02 07:23:21    阅读次数:182
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!