码迷,mamicode.com
首页 >  
搜索关键字:字典树    ( 1305个结果
HDU1671 Phone List (字典树)
题目大意:                输入多串数字串,要求判断是否有的数字串是其它串的前缀。如果存在输出NO,否则输出YES。 解题思路:                用trie建立字典树,然后在每个数字串的结尾处标志1,之后每输入一个串,就判断一下。是否有之前的标志记号。 #include #include #include #include using names...
分类:其他好文   时间:2015-05-06 23:04:23    阅读次数:174
POJ 2418 Hardwood Species(字典树)
Hardwood Species Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 20085   Accepted: 7911 Description Hardwoods are the botanical group of trees that have bro...
分类:其他好文   时间:2015-05-05 08:59:24    阅读次数:144
hdu 1247 Hat’s Words
map水过去了,240ms的样子。。。用字典树应该比map快多了吧。#include#include#include#include#includeusing namespace std;map abc;char s[50005][1000];int main(){ char k[1000];...
分类:其他好文   时间:2015-05-04 20:04:31    阅读次数:112
poj 1251 统计难题(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251AC代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespac...
分类:其他好文   时间:2015-05-04 13:43:32    阅读次数:128
UVa 1556 - Disk Tree
题目:给你一下文件的路径,对文件的路径按照字典序的输出,如果有子目录,下载父目录的下面,            前面加上和深度相同的空格。 分析:字典树,字符串。将路径分解成多级的文件夹和文件,然后按字典序多级排序即可。             这里利用字典树作为存储的数据结构,便于查询。 说明:注意去重。 #include #include #include #include ...
分类:其他好文   时间:2015-05-03 10:40:05    阅读次数:127
hdu 1305 Immediate Decodability
字典树。建树的过程中,一边建树一边判断有没有重复前缀的。#include#include#include#includeusing namespace std;char s[1000]; int i, j, summ;struct nn{ int tot, ling, yi; }dt[50000];...
分类:其他好文   时间:2015-05-03 09:17:31    阅读次数:110
HDU1075 字典树 + 字符串映射
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 ,字典树的字符串映射。 题意是给你每个火星文单词对应的英语,然后让你把一篇火星文文章给翻译成英语。解法: 在Trie树的每个结束标志处加一个字符串,这样就可以对每个火星文单词构造映射。...
分类:其他好文   时间:2015-05-02 18:01:30    阅读次数:127
HDU1247 字典树
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247 ,比较简单的字典树。 刚学字典树不久,多做题练练手。解法: 先输入所有的字符串,建树。然后对所有的字符串进行枚举,将该字符串的前i位与后len-i位分为两个字符串,如果这两个字符串都在树中...
分类:其他好文   时间:2015-05-02 15:09:13    阅读次数:118
hihocoder 1014 Trie树
题目链接:http://hihocoder.com/problemset/problem/1014 ,刚学的字典树,就当模板了。 最近都没有好好刷题,罪过罪过。#include #include #include #include #include #include #include #inc...
分类:其他好文   时间:2015-04-30 00:52:19    阅读次数:124
杭电ACM1671——Phone List~~字典树
这一题,也是简单的字典树的应用,不过这里不是字母,而是数字。 题目的意思是判断输入的字符串会不会是其他字符串的前缀。就是这么的简单。 下面是AC的代码: #include #include using namespace std; class node //结点的结构体 { public: node* P[10]; }; node* root; ...
分类:其他好文   时间:2015-04-29 17:17:39    阅读次数:128
1305条   上一页 1 ... 94 95 96 97 98 ... 131 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!