
字典树
Merry_hj
不完美小孩的完美梦想
展开
-
hdu 1305 Immediate Decodability (字典树入门)
http://acm.hdu.edu.cn/showproblem.php?pid=1305 题目大意:给你一系列字符串,以9位分割线,判断在某个集合里的字符串有没有作为其他字符串的前缀出现。 解题思路:典型的字典树的题,只需要在构造字典树的时候判断这个节点是否可以构成字符串,且为叶子结点。这里出现前缀有两种情况,一是这个字符串还没有插入完,但已经遇到被标记的字符,二是,这个字符串已经插入完,但原创 2017-08-09 18:10:34 · 607 阅读 · 1 评论 -
hdu 2846 Repository
http://acm.hdu.edu.cn/showproblem.php?pid=2846 Problem Description When you go shopping, you can search in repository for avalible merchandises by the computers and internet. First you give the searc原创 2017-08-14 21:48:12 · 463 阅读 · 0 评论 -
hdu 1247 Hat’s Words(字典树)
http://acm.hdu.edu.cn/showproblem.php?pid=1247 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 al原创 2017-08-14 21:25:27 · 313 阅读 · 0 评论 -
hdu 2072 单词数(字典树入门题)
http://acm.hdu.edu.cn/showproblem.php?pid=2072 Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input 有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,原创 2017-08-14 21:16:44 · 1142 阅读 · 0 评论 -
统计难题(字典树或map容器)
http://acm.hdu.edu.cn/showproblem.php?pid=1251 题目大意:给你一个字符串列表,后边给出一些字符串,查询这些字符串作为前缀出现过多少次线段树解法#include <bits/stdc++.h>#define N 26using namespace std;struct Trie{ int cnt; Trie *next[N];原创 2017-08-09 21:22:40 · 383 阅读 · 0 评论 -
hdu 6096 String(详解)
http://acm.hdu.edu.cn/showproblem.php?pid=6096 Problem Description Bob has a dictionary with N words in it. Now there is a list of words in which the middle part of the word has continuous letters d原创 2017-08-12 22:06:25 · 859 阅读 · 0 评论 -
hud 3460 Ancient Printer
http://acm.hdu.edu.cn/showproblem.php?pid=3460 Problem Description The contest is beginning! While preparing the contest, iSea wanted to print the teams’ names separately on a single paper. Unfortun原创 2017-08-11 10:40:02 · 390 阅读 · 0 评论 -
hud 1075 What Are You Talking About (字典树或map)
http://acm.hdu.edu.cn/showproblem.php?pid=1075 Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a hist原创 2017-08-10 19:48:39 · 415 阅读 · 0 评论 -
字典树
在一个单词列表中查找某个单词是否出现过#include <iostream>#include<cstdlib>#define MAX 26using namespace std;typedef struct TrieNode //Trie结点声明{ bool isStr; //标记该结点处是原创 2017-08-09 19:15:50 · 316 阅读 · 0 评论 -
hud 1298 T9(字典树 + DFS详解)
http://acm.hdu.edu.cn/showproblem.php?pid=1298 Problem Description A while ago it was quite cumbersome to create a message for the Short Message Service (SMS) on a mobile phone. This was because you原创 2017-08-15 23:10:31 · 833 阅读 · 0 评论