Trie(字典树)
皮得一1
这个作者很懒,什么都没留下…
展开
-
UVa 1401 Remember the Word(Trie+DP)
题意:输入一个字符串,再输入n个子串,计算出字符串被不同子串组成的方式有几种。 Trie字典树+DP insert()构造字典树,如果是子串,则val记录为1,否则为0,ch为字符的编号。 query()计算字符串中每一个字符可能被子串组成的方式有几种,用sum[]记录。 #include #include #include #define N 300010 #def原创 2015-11-03 13:01:02 · 512 阅读 · 0 评论 -
Uva 11488(Trie数统计最大公共子串长度*个数)
Trie树模板题 #include #include #include using namespace std; int ans; char str[205]; struct Trie { int index; Trie *next[10]; Trie() { index=0; memset(next,0,sizeof(ne原创 2015-11-07 17:11:47 · 440 阅读 · 0 评论 -
poj 2418 Hardwood Species(Trie树)
资料:http://www.cnblogs.com/huangxincheng/archive/2012/11/25/2788268.html 代码 #include #include #include #include using namespace std; typedef struct Tree { Tree *next[129]; int原创 2015-10-31 23:39:47 · 360 阅读 · 0 评论