Given a string, we need to find the total number of its distinct substrings.
InputT- number of test cases. T<=20;
Each test case consists of one string, whose length is <= 1000
OutputFor each test c...
分类:
编程语言 时间:
2015-03-31 22:31:39
阅读次数:
163
【题目描述】给定一个字符串,计算其不同的子串个数。【输入格式】一行一个仅包含大写字母的字符串,长度=n或者所有后缀的排名都不同。 然后正常情况下k增加logN次,每次如果用计数排序只要O(N),一共O(NlogN)。 但是不会写计数排序啊QAQ。。所以用快排好了。。多加一个log,一般不会被卡的.....
分类:
其他好文 时间:
2015-03-30 22:58:49
阅读次数:
277
这道题估计数据比较水,爆搜就能过
从这道题了解到strstr在随机数据的时候比kmp快。。。。正所谓KMP是一种很好的思想,但不实用
接下来就是了解了一些c里的库函数,一开始找不到求子串的函数,写完后才找到strncpy这个函数可以求子串
还有一点要注意的就是得到第一个结果的时候本来可以直接跳出的,但直接跳出的时候可能会碰到一些特殊数据,所以还是用个max记录最大的长度吧。。(这里WA了好多...
分类:
其他好文 时间:
2015-03-29 12:16:26
阅读次数:
90
1093. Count PAT's (25)
时间限制
120 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CAO, Peng
The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th,...
分类:
其他好文 时间:
2015-03-15 09:37:43
阅读次数:
1024
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:
其他好文 时间:
2015-03-15 00:36:38
阅读次数:
159
The stringAPPAPTcontains twoPAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by ...
分类:
其他好文 时间:
2015-03-14 23:04:31
阅读次数:
405
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:
其他好文 时间:
2015-03-06 16:15:45
阅读次数:
149
Assume s is a string of lower case characters.
Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example, if s = 'azcbobobegghakl', then y...
分类:
编程语言 时间:
2015-03-03 22:17:49
阅读次数:
805
Assume s is a string of lower case characters.Write a program that prints the longest substring of s in which the letters occur in alphabetical order....
分类:
编程语言 时间:
2015-03-03 18:11:29
阅读次数:
376
给一个长度为N的字符串S,字符集是[a,z],每个字符都有一个权值Vi,求有多少个子串subS满足以下条件:
1. |subS|>=2
2. subS[0]=subS[|subS|?1]
3. ∑|subS|?2i=1Vi=0...
分类:
其他好文 时间:
2015-03-01 21:05:27
阅读次数:
207