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
10391
UVA
10391
- Compound Words 字符串hash
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1332题目大意:给定一个词典(已经按照字典序排好),要求找出其中所有的复合词,即恰好由两个单词连接而成的单词。(按字典序输出)思路:对于每个单词,存入Hash表,然后对每个单词拆分。Hash函数的选取可以看:
murmured
·
2014-02-12 21:00
编程
ACM
uva
scrollToToday
12-0211:04:16.537:V/TvProgramListFragment(
10391
):@scrollToToday.dateLayoutWidth:931,dateScrollViewWidth
truesea
·
2013-12-02 11:30
scrollToToday
scrollToToday
12-0211:04:16.537:V/TvProgramListFragment(
10391
):@scrollToToday.dateLayoutWidth:931,dateScrollViewWidth
truesea
·
2013-12-02 11:30
scrollToToday
UVa:
10391
Compound Words
题意:给你一个词典,要你输出所有的合成词。思路:凡是词典中出现的单词都使用map做上标记,对于每个单词枚举它的切点,看左右两边的单词是否都被标记,是则说明它是合成词。由于是按字典序输入,所以不必排序。注意:组成合成词的两个单词可能相同,也就是说是同一个词。函数:string的子串: stringsubstr(intpos=0,intn=npos)const;//返回pos开始的n个字符组成的字符串
kkkwjx
·
2013-10-02 22:00
UVA
10391
- Compound Words
题意:找出一连串的字符串中,是否存在两个字符串相组合的字符串出现在所给的字符串中,如果有的话,将组合的那个字符串输出思路:利用哈希函数,将每个单词分为两个部分,都存在哈希表中,搜索是否两个部分都存在,如果有的话,输出#include #include #include #include #defineMAXN120003 usingnamespacestd; typedefcharWord[50]
u011345461
·
2013-09-20 13:00
【索引】Hashing / Sets
BeginningAlgorithmContests(RujiaLiu) Volume3.BruteForce::Hashing/Sets188-PerfectHash10282-Babelfish
10391
u011328934
·
2013-08-31 13:00
uva
10391
Compound Words(stl map)
CompoundWordsYouaretofindallthetwo-wordcompoundwordsinadictionary.Atwo-wordcompoundwordisawordinthedictionarythatistheconcatenationofexactlytwootherwordsinthedictionary.InputStandardinputconsistsofanu
u011328934
·
2013-08-15 22:00
UVA
10391
Compound Words
ProblemE:CompoundWords Youaretofindallthetwo-wordcompoundwordsinadictionary.Atwo-wordcompoundwordisawordinthedictionarythatistheconcatenationofexactlytwootherwordsinthedictionary.InputStandardinputco
·
2013-07-31 20:00
word
UVA
10391
Compound Words
ProblemE:CompoundWordsYouaretofindallthetwo-wordcompoundwordsinadictionary.Atwo-wordcompoundwordisawordinthedictionarythatistheconcatenationofexactlytwootherwordsinthedictionary.InputStandardinputcons
u011217342
·
2013-07-31 10:00
UVa
10391
- Compound Words 字符串hash
ProblemE:CompoundWordsYouaretofindallthetwo-wordcompoundwordsinadictionary.Atwo-wordcompoundwordisawordinthedictionarythatistheconcatenationofexactlytwootherwordsinthedictionary.InputStandardinputcons
cyendra
·
2013-06-06 18:00
题解
字符串
uva
10391
单词复合 利用二分查找求解
#include #include #include #include usingnamespacestd; constintMax=120010; charword[Max][100]; intsearch(char*str,intn) { intleft=0,right=n-1; while(left>1; if(!strcmp(str,word[mid])) retu
wahaha1_
·
2013-05-23 12:00
UVa
10391
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=15&problem=1332&mosmsg=Submission+received+with+ID+11760306思路很简单,写博客目的是记住find、substr的用法#include #include
zhengnanlee
·
2013-05-14 19:00
uva
ACM题解报告
uva
10391
复合词 字符串哈希
head的下标是哈希值,head[哈希值]=字符串的下标,拉链处理矛盾要注意字符串哈希值的取法#include #include charst[121000][30],temp[30]; inthead[10000019],next[121000]; inthash(char*str) { intseed=31,v=0; while(*str) { v=v*seed+*(str++); } ret
yan_____
·
2013-04-16 10:00
uva
10391
- Compound Words
IY题目哈希查找。思路也很简单。首先把所有数据读入,用哈希数组记录出现的单词然后对每个单词进行判断,详细点说,把每个单词分成两部分,然后进入哈希数组,判断两部分是否都是已经存在的单词。代码也不长。#include #include #defineM120013 inthead[M],next[M]; charst[M][30]; intis_equal(intcur,inta,intb,intu)
shankeliupo
·
2013-03-22 21:00
UVA
10391
题意:给定单词集合S,包含若干单词,找出S中所有满足这样条件的元素p:p==str1+str2&&str1属于S&&str2属于S解法:暴力搜;或者用set的查找函数Youaretofindallthetwo-wordcompoundwordsinadictionary.Atwo-wordcompoundwordisawordinthedictionarythatistheconcatenatio
·
2013-02-08 20:00
uva
UVA
10391
Compound Words
大意不再赘述。思路:STL爆过去用了0.128s,一时竟然想不到字符串按长度赋值的库函数,不过写出来还是很快的,动态字典树0.056,哈希函数0.060,今天去新华书店看书回来的路上遇到三个好基友了,结果被他们拖出去玩了一晚上,本来还想瞒他们一阵呢,hiahia,尼玛,我的行踪再次暴露了,--!~手写哈希的时候注意一点,就是first数组的大小要与所写的MAXN的相等,这个BUG找了我好久,囧。。
Wall_F
·
2013-01-23 00:00
Compound Words
10391
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include usingstd::priority_queue; us
gyarenas
·
2012-12-09 21:00
UVa
10391
- Compound Words
好久没有1Y了~~~hash来做,先将所有字符串存入哈希表,然后将每一个字符串分成两个子串,分成的两个子串能在哈希表中找到,则其为“compoundwords”,将其输出。代码如下:#include #include #include #include #include #include usingnamespacestd; constintMAXSIZE=120002; intnum,hea
GooMaple
·
2012-10-16 18:00
insert
uva
10391
- Compound Words
ProblemE:CompoundWordsYouaretofindallthetwo-wordcompoundwordsinadictionary.Atwo-wordcompoundwordisawordinthedictionarythatistheconcatenationofexactlytwootherwordsinthedictionary.InputStandardinputcons
Frankiller
·
2012-08-06 20:00
UVa
10391
- Compound Words
题目链接: UVa:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1332 zoj : http://acm.zju.edu.cn/onlinejudge/showProblem.do?probl
king_tt
·
2012-07-27 13:00
word
UVa
10391
- Compound Words
题目链接:UVa: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1332zoj: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=825类型:Hash原题:Yo
shuangde800
·
2012-07-27 13:00
10391
- Compound Words(***)字符串的哈希函数
/* 题意:一组单词,是否可以分解成两个单词 思路:可以进行重组(一种时间效率为n,但空间分配为n*n,一种时间效率为n*n,空间分配为n) 也可以进行分拆,效率为n*m,其中m为单词平均长度。 主要学习:字符串的哈希处理 另外看别人的代码学习到的新技巧: charstr[n][m]; intr[n]; 借助r来实现对str的排序。 步骤: for(inti=0;i #include cons
lhshaoren
·
2012-02-16 22:00
聚会的快乐
聚会的快乐题目见ural
10391
:#include 2:#include 3:#include 4:#definemaxn6010 5:usingnamespacestd; 6: 7:structss
Sephiroth's boring days!!!
·
2010-09-02 19:00
上一页
1
2
下一页
按字母分类:
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
其他