上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页

2015年8月9日

Uva11732(trie)

摘要: 题意:给你n个字符串 用strcmp()两两比较 ,求字符比较的总次数分析:数据量很大我们考虑用孩子兄弟表示法来表示字典树#include #include #include #include using namespace std;typedef long long ll;const int N ... 阅读全文

posted @ 2015-08-09 17:32 积跬步、至千里 阅读(161) 评论(0) 推荐(0) 编辑

HDU 1251-统计难题(Trie)

摘要: 题意:给一组单词 开始提问每次给一个串求该串是上面几个单词的前缀分析:没给数据规模,但用链表写ME好几次,又用数组写开小RE了,试了几次才过了,真是醉了。。。#include #include #include #include #include #include #include #include... 阅读全文

posted @ 2015-08-09 17:04 积跬步、至千里 阅读(136) 评论(0) 推荐(0) 编辑

HDU 1075-What Are You Talking About(Trie)

摘要: 题意:给你一个字典 一个英文单词对应一个火星单词 给你一段火星文翻译成英文 字典上的没有的不翻译分析:没有给数据规模 字典树用链表#include #include #include #include #include #include #include #include #include #inc... 阅读全文

posted @ 2015-08-09 16:57 积跬步、至千里 阅读(137) 评论(0) 推荐(0) 编辑

UVA 11488-Hyper Prefix Sets(Trie)

摘要: 题意:给一个01串的集合,一个集合的幸运值是串的个数*集合中串的最大公共前缀 ,求所有子集中最大幸运值分析:val[N]表示经过每个节点串的个数求幸运值 求就是每个节点值*该节点的深度 搜一遍树求出最大值#include #include #include #include #include #in... 阅读全文

posted @ 2015-08-09 16:50 积跬步、至千里 阅读(138) 评论(0) 推荐(0) 编辑

HDU 4825-Xor Sum(trie)

摘要: 题意:给你一组数,开始询问给一个数 求组中与该数异或值最大的数。分析:根据异或的特点 要想得到的异或值最大 尽可能的让两个数的每位都相反 先把给定的一组数建树,数的最后一位对应的节点保存这个数的位置(放便取) 对于每个询问 在搜树时优先考虑和当前数位相反的节点。#include #include #... 阅读全文

posted @ 2015-08-09 16:33 积跬步、至千里 阅读(612) 评论(0) 推荐(0) 编辑

POJ 3630- Phone List(Trie)

摘要: 题意:给一组串,是否存在一个串是另一个的前缀。分析:val[N]保存树节点上是否组成一个串#include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文

posted @ 2015-08-09 16:14 积跬步、至千里 阅读(122) 评论(0) 推荐(0) 编辑

POJ 2001-Shortest Prefixes(Trie 入门)

摘要: 题意:给你一组串,求每个串在组中唯一标志的最短前缀分析:保存树上经过各节点的单词个数,扫描每个串当经过节点单词个数是一(能唯一标志)结束#include #include #include #include #include #include #include #include #include #... 阅读全文

posted @ 2015-08-09 15:37 积跬步、至千里 阅读(212) 评论(0) 推荐(0) 编辑

2015年8月3日

poj2686-Traveling by Stagecoach(状压dp)

摘要: 题意:n张马票,m个城市,马票上有马数(决定速度),一张只能用一次,给出地图,求从城市a到b的最短时间。分析:n值很小状态压缩#include #include #include #include #include #include #include #include #include #inclu... 阅读全文

posted @ 2015-08-03 15:23 积跬步、至千里 阅读(233) 评论(0) 推荐(0) 编辑

POJ 3140-Contestants Division(树形dp)

摘要: 题意:n给节点的树,分成两个联通分支,使它们大小的绝对值最小,求这个最小值。分析:分成两个联通分支,即删除一条边,开始看到m(边数)和n(点数)没什么关系,但题目说的是一棵树,则m==n-1,求出所有的可能的差,取最小值即可#include #include #include #include #i... 阅读全文

posted @ 2015-08-03 15:02 积跬步、至千里 阅读(195) 评论(0) 推荐(0) 编辑

POJ 1655-Balancing Act(树形dp)

摘要: 题意:求n个节点的树中哪个节点删除以后得到的最大连通分量最小。分析:同上题#include #include #include #include #include #include #include #include #include #include #include #include #incl... 阅读全文

posted @ 2015-08-03 14:51 积跬步、至千里 阅读(156) 评论(0) 推荐(0) 编辑

上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页

导航