码迷,mamicode.com
首页 > 其他好文 > 详细

字典树-HDOJ-1247-Hat’s Words

时间:2014-11-12 15:04:53      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   io   color   ar   os   java   

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
a ahat hat hatword hziee word
 

Sample Output
ahat hatword
 

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

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



字典树-HDOJ-1247-Hat’s Words

标签:des   style   blog   http   io   color   ar   os   java   

原文地址:http://blog.csdn.net/chuchus/article/details/41042659

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!