Hat’s Words

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 8482    Accepted Submission(s): 3053

Problem Description
A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.

You are to find all the hat’s words in a dictionary.
 
Input
Standard input consists of a number of lowercase words, one per line, in alphabetical order. There will be no more than 50,000 words.

Only one case.
 
Output
Your output should contain all the hat’s words, one per line, in alphabetical order.
 
Sample Input
  1. a
  2. ahat
  3. hat
  4. hatword
  5. hziee
  6. word
 
Sample Output
  1. ahat
  2. hatword
 

大意:给定若干个字符串,找出这种字符串——它可由其它两个字符串拼接得到。
分析:考虑两种特殊情况:
input-----
a
bc
ab
c
abc
output----
abc

input-----
b
ba
baab
baabb
output----
baabb


字典树-HDOJ-1247-Hat’s Words的更多相关文章

  1. hdoj 1247 Hat’s Words(字典树)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247 思路分析:题目要求找出在输入字符串中的满足要求(该字符串由输入的字符串中的两个字符串拼接而成)的 ...

  2. HDU 1247 - Hat’s Words - [字典树水题]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247 Problem DescriptionA hat’s word is a word in the ...

  3. HDU 1247 Hat’s Words(字典树变形)

    题目链接:pid=1247" target="_blank">http://acm.hdu.edu.cn/showproblem.php? pid=1247 Pro ...

  4. hdu 1247:Hat’s Words(字典树,经典题)

    Hat’s Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  5. hdu 1247 Hat’s Words(字典树)

    Hat's Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  6. HDU 1247 Hat’s Words(字典树)

    http://acm.hdu.edu.cn/showproblem.php?pid=1247 题意: 给出一些单词,问哪些单词可以正好由其他的两个单词首尾相连而成. 思路: 先将所有单独插入字典树,然 ...

  7. HDU 1247 Hat’s Words(字典树)题解

    题意:给一个字符串集,要你给出n个字符串s,使s能被所给字符串集中的两个相加所得(ahat=a+hat) 思路:简单字典树题,注意查询的时候要判断所指next是否为NULL,否则会RE非法访问. 代价 ...

  8. HDU 1247 Hat’s Words (字典树 && map)

    分析:一開始是用递归做的,没做出来.于是就换了如今的数组.即,把每个输入的字符串都存入二维数组中,然后创建字典树.输入和创建完成后,開始查找. 事实上一開始就读错题目了,题目要求字符串是由其它两个输入 ...

  9. Hat’s Words HDU - 1247 字典树

    题意:给出数个单词 输出单词 如果该单词 是由字典中的单词组成的 思路:字典树 先把全部建树  然后对于每一个单词进行分割,分别拿两半到字典树里面去找 小心RE! #include<bits/s ...

  10. Hat’s Words(字典树)

    Problem Description A hat's word is a word in the dictionary that is the concatenation of exactly tw ...

随机推荐

  1. View的三次measure,两次layout和一次draw

    我在<Android视图结构>这篇文章中已经描述了Activity,Window和View在视图架构方面的关系.前天,我突然想到为什么在setContentView中能够调用findVie ...

  2. 2015年4月1日 14:36:56 EF 主从表更新

    公司封装框架的人把eF封在了工作单元里面,使用了Unitofwork这样的形式, 我用代码生成器生成了基础的单表操作的代码. 这种方式对多表有问题. 暂时只得,一张表一张表地操作, 我采用先用List ...

  3. dedeCMS常用功能板块记忆

    1.自动调到栏目第一个子栏目 <script> {dede:channel type='son' row='1'} window.location.href='[field:typelin ...

  4. [ CodeVS冲杯之路 ] P1017

    不充钱,你怎么AC? 题目:http://codevs.cn/problem/1017/ 看到题目最下面有一个喜人的提示 那这就意味着我们不用写高精度了是不是,直接开 long long 存 设 f[ ...

  5. [ CodeVS冲杯之路 ] P3027

    不充钱,你怎么AC? 题目:http://codevs.cn/problem/3027/ 显然是DP题,先按线段的右端点升序排序 设 f[i] 为dp到第 i 个线段时最大的价值 目标状态为 max( ...

  6. [ CodeVS冲杯之路 ] P1098

     不充钱,你怎么AC? 题目:http://codevs.cn/problem/1098/ 显然就是使每堆牌达到总体的平均数,尽量使每次移动时的牌数最大,这就类似于飞行棋,将几个棋子叠起来一起走是最优 ...

  7. [LeetCode] Evaluate Reverse Polish Notation stack 栈

    Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...

  8. 杭电oj2064、2067、2068、2073、2076-2078、2080、2083-2085

    2064  汉诺塔III #include<stdio.h> int main(){ int n,i; _int64 s[]; while(~scanf("%d",&a ...

  9. Opengl场景中加光照包含几个步骤

    http://zuoye.baidu.com/question/44e2a82d7ad5c0e1d33ddb9a40e0bf86.html  Opengl场景中加光照包含几个步骤,各个步骤实现用的函数 ...

  10. 谈谈dpdk应用层包处理程序的多进程和多线程模型选择时的若干考虑

    看到知乎上有个关于linux多进程.多线程的讨论:http://www.zhihu.com/question/19903801/answer/14842584 自己项目里也对这个问题有过很多探讨和测试 ...