![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字典树、马拉车、kmp
星空皓月
工欲善其事,必先利其器。
展开
-
HDU - 1247 -- Hat’s Words【字典树】
Hat’s Words 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原创 2020-07-30 10:17:37 · 162 阅读 · 0 评论 -
HDU - 2072 -- 单词数【set or 字典树】
单词数 Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。 Input 有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。 Output 每组只输出一个整数,其单独成行,该整数代表一篇文章里不同单词的总数。 Sample Input you are my friend # Sample Output 4原创 2020-07-30 09:47:58 · 206 阅读 · 0 评论 -
POJ - 2001 -- Shortest Prefixes【字典树】
Shortest Prefixes Description A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb”, “carbo”, and “carbon”. Note that the empty string is not considered a prefix in this pr原创 2020-07-30 10:09:19 · 162 阅读 · 0 评论 -
HihoCoder - 1014 -- Trie树【字典树】
字典树 Input 输入的第一行为一个正整数n,表示词典的大小,其后n行,每一行一个单词(不保证是英文单词,也有可能是火星文单词哦),单词由不超过10个的小写英文字母组成,可能存在相同的单词,此时应将其视作不同的单词。接下来的一行为一个正整数m,表示小Hi询问的次数,其后m行,每一行一个字符串,该字符串由不超过10个的小写英文字母组成,表示小Hi的一个询问。 在100%的数据中n, m<=100000,词典的字母表大小<=26. Output 对于小Hi的每一个询问,输出一个整数Ans,表示词典原创 2020-07-30 09:59:51 · 101 阅读 · 0 评论