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
3461
hdu-
3461
-Code Lock-并查集+高次幂取模
我们可以仔细想一下。我们只看一个区间。任何一种情况这个区间有26种变化。如果总体有n个字符的话,有一个区间的话,那么一共有26^(n-1)种可能。如果有多个区间的话,每个区间可以看成是独立的,如果有x个区间,那么有26^(n-x)种可能。但是有些区间比如【1,3】,【4,5】区间和【1,5】区间是相同的。动【1,5】区间的话,就相当于动【1,3】【4,5】区间。那么就用并查集来查找究竟有几个区间。
rowanhaoa
·
2014-04-18 20:00
POJ
3461
DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter 'e'.HewasamemberoftheOulipogroup.Aquotefromthebook:ToutavaitPairnormal,maistouts’affirmaitfaux.ToutavaitF
u013790563
·
2014-04-18 16:00
POJ
3461
Oulipo(KMP:统计一个串出现的次数)
POJ
3461
Oulipo(KMP:统计一个串出现的次数)http://poj.org/problem?
u013480600
·
2014-04-04 12:00
ACM
poj
3461
Oulipo,Kmp
***************************************** *Author:yew1eb *CreatedTime:2014/3/616:30:33 *FileName:poj
3461
yew1eb
·
2014-03-06 16:00
寒假训练--KMP--poj
3461
Oulipo
OulipoTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 19729 Accepted: 7920DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter 'e'.HewasamemberoftheOul
u013015642
·
2014-02-11 16:00
POJ 1961Period / POJ 2406 Power Strings / POJ
3461
Oulipo /SDUT 2747 循环节 初涉KMP
又到了一学期一次的考试周,然后同学说数据结构要考KMP,然后训练计划上正好也有KMP就顺便看了一下。话说KMP这个算法还是挺形象的,整个算法建立在next数组之上。next[i]存储的为若在第i个字符处匹配失败,指针应回指到的位置。关于KMP的讲解,数据结构课本上已经讲得很详细了,然后网上也有很多博客讲得很不错,所以在这里就不重复了。下面推荐一下几篇不错的博客。http://www.matrix6
u012161037
·
2013-12-23 16:00
武汉性能测试研讨会即将举行!
mod=viewthread&tid=
3461
&fromuid=2
Testing_is_believing
·
2013-12-12 21:00
KMP poj
3461
找一个模式串在主串中出现的次数#include #include usingnamespacestd; constintMAXN=1000010; constintMAXM=10010; intnextval[MAXM]; voidGet_NextVal(char*str) { intlen=strlen(str); inti=0,j=-1; nextval[0]=-1; while(
Hearthougan
·
2013-12-03 11:00
KMP
(串的模式匹配4.6.2)POJ
3461
Oulipo(KMP算法的应用——求一个单词在一行文本中的出现次数)
/* *POJ_
3461
.cpp * *Createdon:2013年10月25日 *Author:Administrator */ #include #include #include usingnamespacestd
caihongshijie6
·
2013-10-26 22:00
POJ 3641 Oulipo KMP 水题
id=
3461
直接KMP就好。
murmured
·
2013-10-19 16:00
poj
3461
Oulipo(kmp 模板题)
id=
3461
题目大意:给你两个串p、t,让你求出p在t中出现的次数。思路:kmp模板题,没什么好说的。。
u010794465
·
2013-10-14 22:00
POJ
3461
和COJ 1248 KMP算法
COJ1248【算法实验项目】串匹配问题TimeLimit:1000ms MemoryLimit:65536KBTotalSubmit:31 Accepted:5Description给定一个文本,在该文本中查找并定位任意给定字符串。Input有两行。第一行为主串S,(长度大于1,不大于1000000)第二行为子串T,(长度大于1,不大于10000)Output输出只有一行。如果子串在母串
u011466175
·
2013-10-11 17:00
poj
3461
Oulipo (KMP)
题目链接: poj
3461
题目大意: 给出主串和模式串,求模式串在主串中出现的次数(部分可以重合)解题思路: KMP从主串的第一个字符开始匹配 开始是匹配成功就立刻退出,再次从上次退出的下一个字符开始匹配
qq7366020
·
2013-10-03 12:00
KMP
poj
3461
poj
3461
Oulipo(KMP裸题)
OulipoTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 17928 Accepted: 7212DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter 'e'.HewasamemberoftheOul
y5885922
·
2013-09-15 00:00
c
算法
ACM
POJ KMP 入门4题
poj
3461
Oulipo 最简单的KMP题,找出第一个字符串在第二个字符串中出现次数。
c3568
·
2013-08-29 10:00
poj
3461
(KMP)
OulipoTimeLimit:1000MS MemoryLimit:65536KTotalSubmissions:17587 Accepted:7059DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter'e'.HewasamemberoftheOulipogr
xj2419174554
·
2013-08-16 16:00
数据结构
字符串
KMP
poj
3461
&& hdu 1686 Oulipo (kmp)
id=
3461
解题报告:字符串匹配关键是next数组不好理解。
ren_hui
·
2013-08-13 22:00
数据结构
字符串匹配
kmp算法
hdu
3461
Code Lock
点击打开hdu
3461
思路:并查集+离散化+快速幂分析:1题目给定长度为n的字符串,然后给定m个操作,询问最后的不同字符串的个数2考虑长度为n的时候,因为每个字符有26种情况('a'~'z'),所以有26
cgl1079743846
·
2013-08-11 18:00
POJ
3461
Oulipo(简单KMP)
OulipoTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 17128 Accepted: 6892DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter 'e'.HewasamemberoftheOul
opm777
·
2013-08-05 14:00
KMP
poj
对比剪花布条
POJ
3461
Oulipo KMP
id=
3461
基本KMP————AC代码:#include #include #include #include #include #include #include #include #include
ilovexiaohao
·
2013-07-21 10:00
KMP
POJ
3461
OulipoTimeLimit:1000MS MemoryLimit:65536KTotalSubmissions:16682 Accepted:6685DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter'e'.HewasamemberoftheOulipogr
cugbbaoge
·
2013-07-19 10:00
poj
Baoge
poj
3461
之kmp入门
OulipoTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 16559 Accepted: 6624DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter 'e'.HewasamemberoftheOul
xingyeyongheng
·
2013-07-08 23:00
poj
3461
kmp
#include #include #include usingnamespacestd; constintmaxn=1e6+9; intnext[maxn]; chara[maxn],b[maxn]; intmain() { //freopen("in.txt","r",stdin); inttcase; scanf("%d",&tcase); while(tcase--) { memset(a
yrleep
·
2013-06-06 01:00
POJ
3461
Oulipo
id=
3461
题意:求模式串在主串中匹配的次数。(题目太啰嗦,直接看输入输出示例...) 分析:KMP的简单转化。
HRHACMER
·
2013-05-07 18:00
hdu
3461
之并查集
CodeLockTimeLimit:2000/1000MS(Java/Others) MemoryLimit:131072/65536K(Java/Others)TotalSubmission(s):722 AcceptedSubmission(s):245ProblemDescriptionAlockyouusehasacodesystemtobeopenedinsteadofake
xingyeyongheng
·
2013-04-21 21:00
POJ
3461
kmp
今天重新读了一遍算法导论上的kmp算法,感觉理解比以前更加深刻了,随手写了这段代码。算法导论中,每次都是拿当前字符的下一个字符去比较,如果不能匹配成功的话,根据之前字符串的最长前缀和最长后缀进行移动字符串。注意注释的那一句,为了找到所有的字符串应该这样移动。#include #include #include charw[10005]; chart[1000005]; intnext[1
chen895281773
·
2013-04-07 16:00
android 定时器
doc-view-
3461
.htmlAndroid 的Timer一般如下面所写 Java代码 Timer timer = new Timer(); TimerTask task = new TimerTask
gaoguoxin2
·
2013-04-01 13:00
poj
3461
KMP模板题
题意:给定两个字符串,求在主串中模式串出现的次数。#include charA[1000005],B[10005]; intnext[10005]; voidgetnext() { inti,j; next[0]=0; for(i=1,j=0;B[i];i++) { while(j>0&&B[i]!=B[j]) j=next[j-1]; if(B[i]==B[j]) j++; next[i
HELLO_THERE
·
2013-03-16 19:00
poj
3461
找子串出现的个数
#include #include #definemax1000010 charW[10010]; charT[max]; intnext[10010]; voidget_next(chartem[]) { intj=0,k=-1; intlen=strlen(tem); next[0]=-1; while(j
wahaha1_
·
2013-01-29 15:00
hdu
3461
Code Lock(并查集+二分求幂)
点击打开链接1、题目大意:给定由N个字母组成的密码锁,如【abcdef】每一位字母都可以转动,转动该字母时,将变成它的下一个字母,如‘a'转动后是b,x转动后是y,接着给定M个区间,每次转动给定区间内的所有字母,如密码锁【abcdef】,给定区间【1,3】转动这个区间一次后变为【bcddef】;注意【1,3】,【3,5】跟【1,5】不同,这会有三种不同的密码锁,因为3重叠,操作了2次,【1,3】,
sdjzping
·
2013-01-29 12:00
POJ
3461
(模式匹配数&覆盖函数)
Language:DefaultOulipoTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 14051 Accepted: 5667Description给出两个字符串W和T,求T中有几个W子串。Input第一行为数据数.每组数据有两行W和T,表示模式串和原始串.Output对每组数据,每行一个数,表示匹配数.SampleInput3
nike0good
·
2012-11-15 08:00
KMP算法学习之(三):初步实战POJ
3461
感觉大概已经了解到KMP算法了,就去搜索POJ上面的水题来练习一下,找找感觉!一找就发现问题了!我对KMP算法还没有领悟进入! 我开始的代码是这样写的: #include #include #define MT 1000005 #define MP 10005 char t[MT],p[MP]; int t_len,p_len; int n
sbp810050504
·
2012-11-09 13:25
kmp算法
POJ3461
KMP算法学习之(三):初步实战POJ
3461
感觉大概已经了解到KMP算法了,就去搜索POJ上面的水题来练习一下,找找感觉!一找就发现问题了!我对KMP算法还没有领悟进入!我开始的代码是这样写的:#include #include #define MT 1000005 #define MP 10005 char t[MT],p[MP]; int t_len,p_len; int next[MP];//next又可以看作从前缀的末尾往前数
sbp810050504
·
2012-11-09 13:25
KMP算法
POJ3461
数据结构与算法
poj
3461
Oulipo Rabin-Karp 字符串匹配
poj
3461
OulipoRabin-Karp字符串匹配 裸的字符串匹配,子串最长10,000,母串最长1,000,000。 求子串在母串中出现的次数。
yx
·
2012-09-28 12:00
HDU
3461
Code Lock(并查集+二分求幂)
pid=
3461
原题:ProblemDescriptionAlockyouusehasacodesystemtobeopenedinsteadofakey.Thelockcontainsasequenceofwheels.Eachwheelhasthe26lettersoftheEnglishalphabet'a't
shuangde800
·
2012-09-14 00:00
POJ
3461
Oulipo(KMP求匹配次数)
/* 题意:求某一单词在句子中出现的次数。 做这道题的时候,匹配算法搞了很久,最后终于想明白了,受传统模式匹配算法的影响,认为①处也需要对i做一次变化。 */ #include #include #include usingnamespacestd; constintwMax=10010; constinttMax=1000010; chars[wMax],ss[tMax]; intnext[
lhshaoren
·
2012-08-23 22:00
优化
算法
【KMP】 poj
3461
Oulipo
id=
3461
DescriptionTheFrenchauthorGeorgesPerec(1936–1982)oncewroteabook,Ladisparition,withouttheletter
ACM_Ted
·
2012-08-02 10:00
KMP水题四枚
POJ
3461
KMP最裸的题了,大牛勿喷constintMAXV=12000; stringa,b; inttcase,next[MAXV]; intmain() { //freopen("
3461
speedcell4
·
2012-07-03 22:00
poj
3461
题意:给你一个字串(模式串)和一个母串(文本),问字串在母串中出现的次数。 思路:最基础的KMP算法。在匹配完成一个之后,应该j=next[j],不能j=0,保证模式串在文本的所有种出现情况都包含到,这里注意下就可以了。 代码如下: // #include<iostream> #include <iostream> using namespace
cavenkaka
·
2012-06-27 19:00
poj
poj
3461
next[]数组,next[j]的值表示当模式中第j个字符与主串中相应字符失配时,在模式串中需要重新和主串中该字符进行比较的字符的位置。对于next[]数组的定义如下:1)next[j]=0 j=12)next[j]=maxk:0 #include chars1[1001000],s2[10010]; intnext[10010]; voidgetnext(){ inti=1,j=0,k; nex
waitfor_
·
2012-06-23 23:00
[KMP求模式在主串出现次数]POJ
3461
Oulipo
id=
3461
题目大意:给定一个主串和一个模式,求模式在主串中出现的次数。
Coco_young
·
2012-06-23 17:00
poj
KMP算法的练习题(poj
3461
、poj 2752、poj 2406、poj 1961)
//poj
3461
Oulipo最简单的KMP题,找出第一个字符串在第二个字符串中出现次数。
lalor
·
2012-03-15 22:00
c
算法
[KMP]poj
3461
:Oulipo
大致题意: 给出两个字符串,求出模式串pat在母串text中出现了多少次。 大致思路: 基础的KMP算法,要理解KMP的实现原理。(http://bbezxcy.iteye.com/blog/1355293 kmp算法详解) #include<iostream> #include<cs
暴风雪
·
2012-01-25 02:00
字符串
KMP
poj 3461
Oulipo
HDU
3461
Code Lock 并查集应用
/* 这题程序不难,关键想法比较难,以下内容来自别人的空间 如果没有区间存在,答案是26^n,每增加一个区间,n-1(因为这个区间可以变成26种状态~). 但是要注意的是,比如已经有(1,10)和(1,3)在了,此时再增加(4,10)就没有作用了 使用并查集对于[l,r]我们将l,r+1两个点并起,如果新线段的两个点是同一个集合,就不用减了 */ #include #include"
mishifangxiangdefeng
·
2012-01-20 09:00
id=
3461
&&kmp
这一题真是让我纠结,,本以为kmp算法已经掌握很熟练了,木想到tle,,尼玛的什么kmp,然后又看了看书,,发现这竟然和我写的kmp不一样,于是按书重新写了一遍,竟然木有超时,,我表示很受伤啊!!AC代码:#include #include #include usingnamespacestd; intNext[10001]; stringa,b; voidkmp() {intn=a.size()
smallacmer
·
2012-01-04 10:00
算法
String
IM
poj Oulipo(KMP)
id=
3461
题意:有两个字符串,ch1,ch2(strlen(ch1) #include #include #include usingnamespacestd; #defineM10001 intt
yhrun
·
2011-11-16 19:00
算法
String
POJ-
3461
Oulipo
id=
3461
题目大意:给你两个字符串p和s,求出p在s中出现的次数。解题思路:这道题跟POJ2406有点相似,那道题是求abcabcabc,则就是3次。而这道题,abababa中aba出现了3次。
niushuai666
·
2011-11-14 21:00
poj
3461
KMP算法求可重复利用的子串个数
这道题想了好久,,提交了好久,,改了好久,,,,,终于ac了,,,,,,学KMP的伤不起啊!!!!!前几天做了不可重复利用的子串的个数,,当时是1A了,本以为这题应该也不难,,,却悲剧了这么久。。。。现在已经不是一天做几道题,,而是几天做一道题,,,,题目:OulipoTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 9360
wmn_wmn
·
2011-11-10 15:00
POJ
3461
裸KMP,求优化 #include usingnamespacestd; constintMAXN=1000012; #ifndef_KMP_ #define_KMP_ inttcase,next[MAXN]; chars[MAXN],p[MAXN]; intKMP(chars[],charp[]); voidSetNextArray(charp[],intnext[]); #endif
speedcell4
·
2011-10-15 16:00
poj
3461
Oulipo kmp 预处理
这道题主要是prenext函数的作用,譬如说abababa如果不是先处理aba数组,那结果必然是1了,预处理用next数组将aba中的a指向前一个b在next数组里就是-1,-1,0,这样搜到aba中的最后一个a结束的时候next数组会返回到b那个位置具体还请读者自己慢慢体会啊!!!!!!!!#include usingnamespacestd; #definemax1000001 int
youngyangyang04
·
2011-10-09 00:00
上一页
1
2
3
4
5
6
7
下一页
按字母分类:
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
其他