题意就是求一个字符串的重复出现(出现次数>=2)的不同子串的个数。标准解法是后缀数组、最长公共前缀的应用,对于样例aabaab,先将所有后缀排序: aab3 aabaab1 ab2 abaab0 b1 baab每个后缀前面数字代表这个后缀与它之前的后缀(rank比它小1)的最长公共前缀...
分类:
编程语言 时间:
2015-05-25 14:23:38
阅读次数:
190
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representatio...
分类:
编程语言 时间:
2015-05-20 01:57:32
阅读次数:
192
#1152 : Lucky Substrings时间限制:10000ms单点时限:1000ms内存限制:256MB描述A string s is LUCKY if and only if the number of different characters in s is a fibonacci n...
分类:
其他好文 时间:
2015-05-17 18:32:32
阅读次数:
218
用","分隔 Split a string into an array of substrings: 示例: var?str?=?"How?are?you?doing?today?";
var?res?=?str.split("?"); The result of?res?will be an array with the values: 结果: H...
分类:
其他好文 时间:
2015-05-14 12:25:24
阅读次数:
150
Icerainlikes strings very much. Especially the strings only consist of0and1,she call them easy strings. One day, she is so boring that she want to fin...
分类:
其他好文 时间:
2015-04-30 00:58:18
阅读次数:
127
传送门:Repeated Substrings题意:给定一个字符串,求至少重复一次的不同子串个数。分析:模拟写出子符串后缀并排好序可以发现,每次出现新的重复子串个数都是由现在的height值减去前一个height值。#include #include #include #include #inclu...
分类:
编程语言 时间:
2015-04-27 12:58:48
阅读次数:
174
A. Lucky Substrings这道题并不难,由于字符串长度只有100,那么它的子串肯定不超过1w个,枚举出所有字串都是没有问题的,至于检验一个子串里面不同的字母数量是不是斐波那契数,我们只需要事先把斐波那契数列小于1w的项都生成出来,然后枚举一个子串之后,统计出不同字母的数量(边找边统计,如果当前字母之前出现过就不加,如果没出现过就记住并+1),去这个里面找就行了。斐波那契数列推不了几项就到...
分类:
其他好文 时间:
2015-04-26 09:27:35
阅读次数:
317
POJ1226——Substrings
题意,给定一堆字符串,找出最大的公共子串。
//Date: 2015.04.25
//Time: 0ms
//Memory: 144k
#include
#include
using namespace std;
const int MAX_LEN=105;
int n,index,length;
char str[100][...
分类:
其他好文 时间:
2015-04-25 22:50:44
阅读次数:
161
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
great
/ gr ...
分类:
其他好文 时间:
2015-04-23 17:40:47
阅读次数:
205
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
great
/ gr ...
分类:
编程语言 时间:
2015-04-17 11:38:26
阅读次数:
129