E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Substrings
[LeetCode] Scramble String 字符串 dp
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty
substrings
·
2015-10-31 09:22
LeetCode
[后缀数组、不重复子串]SPOJ694、spoj705--Distinct
Substrings
题目大意:给出一个字符串,问它的不重复子串有多少个。两题是一样的,除了字符串长度....... 思路:用后缀数组可以轻松解决。因为这个字符串的每个子串必然是某个后缀的前缀,先用后缀数组求出sa和height,那么对于sa[k],它有n-sa[k]个子串,其中有height[k]个是和上一个后缀重复的,所以要减去。所以用后缀数组求解的时间复杂度是O(n),后缀数组要是用倍增算法是O(nlog2n)
·
2015-10-31 09:47
substring
CF 两题
A and B and Interesting
Substrings
time limit per test 2 seconds memory limit per test 256 megabytes
·
2015-10-31 09:14
c
POJ3415 Common
Substrings
后缀数组 求长度不小于k的公共子串的个数 代码: 1 #include <stdio.h> 2 #include <string.h> 3 4 const int maxn = 200011; 5 int len, len1; 6 int wa[maxn], wb[maxn], wv[maxn], wd[maxn],
·
2015-10-31 09:54
substring
Count Good
Substrings
Count Good
Substrings
Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on 
·
2015-10-31 08:25
substring
Codeforces 451D
Count Good
Substrings
time limit per test 2 seconds memory limit per test 256 megabytes input
·
2015-10-30 14:27
codeforces
Codeforces Round #306 (Div. 2)
Two
Substrings
给出一个字符串,如果同存在不重叠的AB和BA,输出YES,否则输出NO 先找AB再找BA,是不行的,比如BABCCCAB 还有一种方法是,先找到AB,
·
2015-10-30 13:58
codeforces
Codeforces Round #294 (Div. 2)D - A and B and Interesting
Substrings
字符串
A and B and Interesting
Substrings
time limit per test 2 seconds memory limit per test 256 megabytes
·
2015-10-30 13:02
codeforces
【leetcode】 Scramble String (hard)★
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty
substrings
·
2015-10-27 15:37
LeetCode
Hackerrank--Ashton and String(后缀数组)
Arrange all the distinct
substrings
of a given string in lexicographical order and concatenate
·
2015-10-27 15:12
String
Substrings
(hdu1238)字符串匹配
Substrings
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission
·
2015-10-27 14:53
substring
SPOJ 694 Distinct
Substrings
Distinct
Substrings
Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on 
·
2015-10-27 13:45
substring
UVALive 6869 Repeated
Substrings
Repeated
Substrings
Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: 
·
2015-10-27 13:29
substring
SPOJ NSUBSTR
Substrings
DescriptionYouaregivenastringSwhichconsistsof250000lowercaselatinlettersatmost.WedefineF(x)asthemaximalnumberoftimesthatsomestringwithlengthxappearsinS.Forexampleforstring'ababa'F(3)willbe2becausether
jtjy568805874
·
2015-10-24 23:00
spoj
Substrings
HDU 2138 (STL +寻找相同串中的最大公共串(贪心))
思路:要找到所有的串的最大公共串,一定存在于最小的串中所以先找到最小的串,然后再找出这最小长度的母串的子串所能组成的序列,然后不停的和其他串像比较找到最长子串就可以.#include #include #include #include #include #include #include #definell__int64 #defineinf0x3f3f3f3f usingnamespacest
Grit_ICPC
·
2015-10-23 19:00
STL
贪心
Substrings
(后缀自动机模板)
后缀自动机+dp。 后缀自动机主要是在functioner大牛那里学习的:http://blog.sina.com.cn/s/blog_70811e1a01014dkz.html 这道题是在No_stop
·
2015-10-23 09:19
substring
Two
Substrings
水题
Two
Substrings
Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem
·
2015-10-23 09:01
codeforces
TOJ 2749 Absent
Substrings
描述 Given a string of symbols, it’s natural to look it over and see what
substrings
are present.
·
2015-10-23 08:41
substring
[leedcode 87] Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty
substrings
·
2015-10-21 12:45
String
poj-1226
Substrings
***
/* * 1226 KMP * * 用的KMP, O(n^3) * 由于数据规模小, 直接暴力枚举最短串的各个子串再依次与其他串KMP应该也能过 (复杂度也是O(n^3)) * * 这里不直接枚举各个子串, 而是枚举子串的起点位置, 依次与其他串KMP, 记录和每个串及其反串的最大匹配长度, * 再以此计算这些值的最小值, 就得到该起点的子串所能达到的最大匹配长度(与刚才的方法其实差不多)
·
2015-10-21 12:48
substring
Distinct
Substrings
(不相同的子串的个数)
Distinct
Substrings
Problem code: DISUBSTR Given a string, we need to find the
·
2015-10-21 12:12
substring
Which are in?
return a sorted array in lexicographical order and without duplicates of the strings of a1 which are
substrings
·
2015-10-21 12:52
in
hdu1238
Substrings
(暴力)
pid=1238
Substrings
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K
·
2015-10-21 10:16
substring
用Python刷Codeforces水题
Two
Substrings
题意:问是否存在不重叠的串AB和BA。 思路:注意ABABA、BABAB这两种情况都应该是YES。
·
2015-10-21 10:10
codeforces
CF#306- A - Two
Substrings
-水题
给出一个字符串,求是否同时存在”AB“ ”BA“ 先遍历一次AB,然后标记掉,再遍历一遍BA就好了预防出现ABAAB这种情况还要先遍历一次BA,标记掉再遍历AB#include #include #include #include #include #include #include #include #include #include usingnamespacestd; chartm[10
viphong
·
2015-10-08 07:00
HDU 1238
Substrings
(求公共正反向连续子串)
SubstringsTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):8504AcceptedSubmission(s):3931ProblemDescriptionYouaregivenanumberofcase-sensitivestringsofalphabeti
Sterben_Da
·
2015-09-24 21:00
poj3415Common
Substrings
(好题)
CommonSubstringsTimeLimit:5000MS MemoryLimit:65536KTotalSubmissions:8519 Accepted:2812DescriptionAsubstringofastringTisdefinedas:T(i,k)=TiTi+1...Ti+k-1,1≤i≤i+k-1≤|T|.GiventwostringsA,BandoneintegerK,w
acm_fighting
·
2015-09-21 14:00
hdu 4455
Substrings
比赛的时候一直往离线+数据结构上想sigh,不过最后正解中也的确带有"离线处理"---------------------------------------------------------------------------------------------------------------------------------首先我们可以很明显地发现区间个数是$nq$级别的所以莫队什么的
sagitta
·
2015-09-06 07:00
POJ 1226 && HDU 1238
Substrings
(kmp)
Desciption给出n个字符串,求出一个最长的串,使得这个串或者这个串的回文在所有n个字符串中都出现Input第一行为用例组数t,每组用例第一行为串数n,之后n行每行一个字符串Output对于每组用例,输出满足条件的最长串长SampleInput23ABCDBCDFFBRCD2roseorchidSampleOutput22Solution枚举第一个串的所有子串及其反串,在其他串中用kmp大法
V5ZSQ
·
2015-09-02 08:00
HDU 4455
Substrings
(dp+树状数组优化)
题意:给定一个序列ai,个数为n。再给出一系列w;对于每个w,求序列中,所有长度为w的连续子串中的权值和,子串权值为子串中不同数的个数解析:一直想不出来怎么转移,看了网络上面的题解才明白怎么做。dp[i]表示w=i时所求的答案。dp[1]=n,这个很容易知道,dp[2]中的子串就是删去dp[1]中最后一个子串,再令每个子串加上其之后的那个数,以此类推要删去的最后一个子串的权值很好求,for一遍就能
HelloWorld10086
·
2015-08-31 21:00
HDU
4455
UVALive 6659 Dromicpalin
Substrings
枚举判断
枚举每个位置为起点,然后判断有多少个为奇数的字母,为奇数的 #include #include #include usingnamespacestd; intnum[200]; charword[2000]; intmain(){ intn,tt=1; scanf("%d",&n); while(n--){ intans=0; scanf("%s",word); intlen=strlen(wo
firenet1
·
2015-08-25 19:00
uvalive
6659
Dromicpalin
Substrin
枚举判断
HDOJ 4455
Substrings
递推+树状数组
pre[i]第i位数往前走多少位碰到和它相同的数dp[i]表示长度为i的子串,dp[i]可以由dp[i-1]加上从i到n的pre[i]>i-1的数减去最后一段长度为i-1的断中的不同的数得到....爆int+有点卡内存....SubstringsTimeLimit:10000/5000MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)T
u012797220
·
2015-08-18 22:00
uva10829 L-Gap
Substrings
传送门:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=20&page=show_problem&problem=1770思路:这题和上一题SPOJ687的思路一样,也是枚举长度,再对于i和i+j+L向前向后匹配,但是这一题只能在后面接一个反串。#include #include #inc
thy_asdf
·
2015-08-18 15:00
后缀数组
A and B and Interesting
Substrings
(hash+dp)
题目链接:codeforces519D题目大意:给出一个字符串,给出每个字母的权值,求字符串的子串中首尾相等,除去首尾字母的权值和为0的数量。题目分析:从前到后扫描字符串,计算前缀和,每次将前缀和Hash,然后每次查询与当前位字母相同的前缀和与当前前缀和相等的前缀的数量,间接地计算出字符串的数量。AC代码:#include #include #include #include #include #
qq_24451605
·
2015-08-14 18:00
dp
hash
codeforces
HDU 1238
Substrings
题目地址:点击打开链接思路:string的子串:stringsubstr(intpos=0,intn=npos)const;//返回pos开始的n个字符组成的字符串intfind(conststring&s,intpos=0)const;//从pos开始查找字符串s在当前串中的位置查找成功时返回所在位置,失败返回string::npos的值AC代码:#include #include #inclu
qq_25605637
·
2015-08-12 18:00
hihoCoder - 1152 - Lucky
Substrings
hihoCoder1152:LuckySubstrings时间限制:10000ms 单点时限:1000ms 内存限制:256MB描述AstringsisLUCKYifandonlyifthenumberofdifferentcharactersinsisafibonaccinumber.Givenastringconsistingofonlylowercaseletters,o
violet_echo_0908
·
2015-08-02 11:00
String
set
字符串处理
hihiCoder
UVALive 4671 (LA 4671) K-neighbor
substrings
(2009年合肥) FFT
题目大意:就是现在定义两个字符串之间的Hamming距离指的是两个相同长度的字符串对应位置字符不同的位置数量,例如“aab"和”bab"的Hamming距离是1因为第一个字符不一样现在给出K个两个只包含字符'a','b'的字符串A和B,求A的子串中与B的Hamming距离不超过K的本质不同的子串数量,即如果"aaa"在A中出现两次及以上且满足条件也只记一次大致思路:首先这个题之前以为是可以用后缀自
u013738743
·
2015-07-15 14:00
substring
uvalive
fft
la
4671
4671
K-neighbor
Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty
substrings
hcx2013
·
2015-07-08 22:00
String
hihocoder Lucky
Substrings
题目时间限制:10000ms单点时限:1000ms内存限制:256MB描述AstringsisLUCKYifandonlyifthenumberofdifferentcharactersinsisafibonaccinumber.Givenastringconsistingofonlylowercaseletters,outputallitsluckynon-emptysubstringsinle
u010902721
·
2015-07-05 22:00
算法
String
面试题
CodeForces 550A Two
Substrings
(模拟)
【题目链接】clickhere~~ 【题目大意】: Youaregivenstrings.Yourtaskistodetermineifthegivenstringscontainstwonon-overlappingsubstrings“AB”and“BA”(thesubstringscangoinanyorder). Input Theonlylineofinputcontainsastrin
u013050857
·
2015-06-27 11:00
codeforces
Substrings
(hd1238)
Substrings
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K
·
2015-06-23 13:00
substring
CSU1632: Repeated
Substrings
(后缀数组)
DescriptionStringanalysisoftenarisesinapplicationsfrombiologyandchemistry,suchasthestudyofDNAandproteinmolecules.Oneinterestingproblemistofindhowmanysubstringsarerepeated(atleasttwice)inalongstring.In
libin56842
·
2015-06-09 20:00
后缀数组
CSU
Codeforces550A:Two
Substrings
Youaregivenstring s.Yourtaskistodetermineifthegivenstring s containstwonon-overlappingsubstrings"AB"and"BA"(thesubstringscangoinanyorder).InputTheonlylineofinputcontainsastring s oflengthbetween 1 and
libin56842
·
2015-06-09 15:00
codeforces
POJ1226:
Substrings
(后缀数组)
DescriptionYouaregivenanumberofcase-sensitivestringsofalphabeticcharacters,findthelargeststringX,suchthateitherX,oritsinversecanbefoundasasubstringofanyofthegivenstrings.InputThefirstlineoftheinputcon
libin56842
·
2015-06-08 14:00
poj
后缀数组
POJ3415:Common
Substrings
(后缀数组+单调栈)
DescriptionAsubstringofastring T isdefinedas:T(i, k)=TiTi+1...Ti+k-1,1≤i≤i+k-1≤|T|.Giventwostrings A, B andoneinteger K,wedefine S,asetoftriples(i, j, k):S ={(i, j, k)| k≥K, A(i, k)=B(j, k)}.Youaretog
libin56842
·
2015-06-07 22:00
poj
SPOJ694&&SPOJ705:Distinct
Substrings
(后缀数组)
DescriptionGivenastring,weneedtofindthetotalnumberofitsdistinctsubstrings.InputT-numberoftestcases.T #include #include #include #include #include #include #include #include #include #include #include
libin56842
·
2015-05-29 15:00
后缀数组
spoj
HDOJ 1238
Substrings
SubstringsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):8078 AcceptedSubmission(s):3688ProblemDescriptionYouaregivenanumberofcase-sensitivestringsofa
zwj1452267376
·
2015-05-22 21:00
SPOJ 705 New Distinct
Substrings
DescriptionGivenastring,weneedtofindthetotalnumberofitsdistinctsubstrings.InputT-numberoftestcases.T #include #include #include #include #include #include #include usingnamespacestd; constintMin=0; co
jtjy568805874
·
2015-05-21 11:00
spoj
SPOJ 694 Distinct
Substrings
DescriptionGivenastring,weneedtofindthetotalnumberofitsdistinctsubstrings.InputT-numberoftestcases.T #include #include #include #include #include #include #include usingnamespacestd; constintMin=0; co
jtjy568805874
·
2015-05-21 11:00
spoj
Leetcode - Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty
substrings
likesky3
·
2015-05-17 14:00
LeetCode
上一页
5
6
7
8
9
10
11
12
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他