
Trie
文章平均质量分 78
vocaloid01
小菜鸟一只_(:з」∠)_前来膜拜各路大佬orz
展开
-
HihoCoder - 1383 北京赛区(2016)网络赛——The Book List(字典树模拟)
The history of Peking University Library is as long as the history of Peking University. It was build in 1898. At the end of year 2015, it had about 11,000 thousand volumes of books, among which 8,000...原创 2018-09-11 21:27:36 · 235 阅读 · 0 评论 -
HDU - 6191 Query on A Tree (01字典树+DFS序+启发式合并)
Monkey A lives on a tree, he always plays on this tree. One day, monkey A learned about one of the bit-operations, xor. He was keen of this interesting operation and wanted to practise it at once. ...原创 2018-07-15 21:04:37 · 239 阅读 · 0 评论 -
01字典树模板
typedef struct Node* node;struct Node{ int val; int num; node Next[2]; Node() { val = num = 0; memset(Next,NULL,sizeof(Next)); }};void Insert(node root,int x,int flag)//flag的正负对应了加入和删除...原创 2018-07-15 15:26:11 · 140 阅读 · 0 评论 -
HDU - 5536 Chip Factory (01字典树)
John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory produces ...原创 2018-07-15 15:21:35 · 217 阅读 · 0 评论 -
HDU - 4825 Xor Sum (01字典树入门经典题)
Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大,随即同意 Zeus 可以向人类求助。你能证明...原创 2018-07-15 12:20:15 · 173 阅读 · 0 评论 -
HDU - 1251 统计难题
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一...原创 2018-07-15 11:24:26 · 142 阅读 · 0 评论 -
HihoCoder - 1014 Trie树 (字典树入门)
题目:点击打开链接代码:#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <algorithm>using namespace std;char s[15];typedef struct Node* node...原创 2018-07-15 11:19:57 · 168 阅读 · 0 评论 -
基础字典树模板
char s[MAXN];typedef struct Node* node;struct Node{ int Num;//常见的是存数,具体的根据题更改 node Next[26]; Node() { Num = 0; memset(Next,NULL,sizeof(Next)); }};void Insert(node root){ node p = r...原创 2018-07-15 10:31:44 · 134 阅读 · 0 评论 -
POJ - 2503 Babelfish
You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them. ...原创 2018-07-15 10:11:00 · 158 阅读 · 0 评论