|
Hat’s WordsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5729 Accepted Submission(s): 2135
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
Sample Output
Author
戴帽子的
Recommend
Ignatius.L
题意:把单词分成两个,然后判断是不是为出现的单词,直接把单词建树,然后把单词分成两个部分找到即可。
|
hdu 1247 Hat’s Words Trie树
最新推荐文章于 2021-02-23 14:50:36 发布