码迷,mamicode.com
首页 >  
搜索关键字:trie    ( 2375个结果
HDU 5384 Danganronpa (Trie树)
题意:给出两个集合S和T,集合中每个元素是个字符串,而T集合中任一元素都是个子弹,可以打S中的任一怪物,如果子弹是怪物的子串,那么才有伤害值1,若在怪物中出现多次,次数为该子弹打到该怪物的伤害值。每个子弹可以射不同怪物分别一次。求用完所有子弹,每个怪物受到的伤害值。思路:先将所有子弹插到Trie树中...
分类:其他好文   时间:2015-08-13 19:34:43    阅读次数:246
hdu 1247 Hat’s Words Trie树(+测试数据)
Hat’s WordsTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 1247DescriptionA hat’s word...
分类:其他好文   时间:2015-08-13 17:49:43    阅读次数:105
hdu4287 字典树
#include#include#include#define maxn 10struct trie{ trie *next[10]; int sum; int flag;};trie *root;char way[5010][10];void init(){ root=(t...
分类:其他好文   时间:2015-08-12 18:24:33    阅读次数:96
hdu2846 字典树
给你一堆字符串,然后再给你几个查询,前面那些字符串中有多少个包含了这个串。所以可以把开始inset()的字符遍历一遍,同时可能出现该字符串在某个字符串中有多次出现,所以还要用flag标记,来区分不同的串。#include#include#includestruct trie{ int flag...
分类:其他好文   时间:2015-08-12 16:35:22    阅读次数:115
hdu 1247 Hat’s Words
点击此处即可传送到 hdu 1247 **Hat’s Words**Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are t...
分类:其他好文   时间:2015-08-11 18:43:53    阅读次数:112
hdu 1251 统计难题(trie树入门)
统计难题Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 24521Accepted Submission(s): 10133Problem Des...
分类:其他好文   时间:2015-08-11 17:52:04    阅读次数:165
hdu 1251 统计难题(给定字典单词,查询以某单词为前缀的单词的个数)
代码:#include #include #include using namespace std; struct Node { int cnt; Node * next[26]; void init() { cnt=0; for(int i=0; i<26; i++) { next[i]=N...
分类:其他好文   时间:2015-08-11 14:09:48    阅读次数:122
【HDU 4760】Good Firewall(Trie水题)
计算机网络没学好,比赛的时候脑子一抽题意理解错了,赛后自己写了1A,内流满面。。。。 和一般的trie不太一样,这里的trie每个节点开一个vector存网络的id 恩,就这样,跑的挺快的 78ms #include #include #include #include #include #include #include #define LL long long using namespa...
分类:其他好文   时间:2015-08-10 22:23:12    阅读次数:136
【暑假】[实用数据结构]前缀树 Trie
前缀树TrieTrie可理解为一个能够快速插入与查询的集合,无论是插入还是查询所需时间都为O(m)模板如下: 1 const int maxnode = 1000+10; 2 const int sigma_size = 26; 3 4 struct Trie{ 5 int ch[maxnode.....
分类:其他好文   时间:2015-08-10 21:34:28    阅读次数:130
单词默写题解--Trie树模板
单词默写 ★☆ 输入文件:engzam.in 输出文件:engzam.out 简单对比 时间限制:1 s 内存限制:128 MB 【问题描述】 小D前一段日子刚刚参加了一次非常苛刻的英语考试。 考试不仅包括了听力、选择、填空等基本题型,还包括了一种特殊的单词默写题。这类题目都是按照以下形式给出的: 在本学期你所学的所有前缀是B的单词中,在课本中出现次数不...
分类:其他好文   时间:2015-08-10 13:42:37    阅读次数:123
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!