字典树
文章平均质量分 70
wsxsd94
这个作者很懒,什么都没留下…
展开
-
Hdu1075 - What Are You Talking About - 字典树
#include #include struct tree { int count; tree *next[30]; char c[20]; int mark; tree() { count=0; mark=0; for(int i=0;i<26;i++) { next[i]=NULL; } } }*root; void build(char *ch,cha原创 2014-08-03 16:05:11 · 534 阅读 · 0 评论 -
Hdu1251 - 统计难题 - 字典树
#include #include struct tree { int count; tree *next[30]; tree() { count=0; for(int i=0;i<26;i++) { next[i]=NULL; } } }*root; void build(char *word) { tree *item=root; for(int i=0;w原创 2014-08-03 16:01:31 · 454 阅读 · 0 评论 -
Hdu1800 - Flying to the Mars - 字典树
#include char num[50]; int ans; struct tree { int cnt; tree *next[15]; tree() { cnt=0; for(int i=0;i<15;i++) { next[i]=NULL; } } }*root; int max(int a,int b) { return a>b?a:b; } void原创 2014-08-07 09:19:20 · 423 阅读 · 0 评论 -
POJ1204 - Word Puzzles - 字典树
#include #include char map[1005][1005]; char s[1005]; int m,n,t; int sx,sy; int div[8][2]={{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}};// struct ANS { int x,y; char towards; }ans[1005]; s原创 2014-08-06 16:40:01 · 497 阅读 · 0 评论 -
Hdu1247 - Hat’s Words - 字典树
#include #include char str[50001][50]; char map[1005][1005]; char s[1005]; int m,n,t; int sx,sy; int div[8][2]={{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}}; struct ANS { int x,y; char tow原创 2014-08-06 18:38:36 · 451 阅读 · 0 评论 -
Hdu1298 - T9 - 字典树
#include #include char word[105],num[105],ans[105],it[105]; int times,flag; int phone[8][4]={{0,1,2},{3,4,5},{6,7,8},{9,10,11},{12,13,14},{15,16,17,18},{19,20,21},{22,23,24,25}}; int ch[8]={3,3,3,3,3,原创 2014-08-06 14:43:44 · 467 阅读 · 0 评论 -
POJ2503 - Babelfish - 字典树
#include #include struct tree { int count; tree *next[30]; char c[20]; tree() { count=0; for(int i=0;i<26;i++) { next[i]=NULL; } } }*root; void build(char *ch,char *word) { tree *ite原创 2014-08-03 16:06:14 · 445 阅读 · 0 评论 -
POJ2001 - Shortest Prefixes - 字典树
#include #include char word[1001][21]; struct tree { tree *next[30]; int time; int fin; tree() { for(int i=0;i<30;i++) { next[i]=NULL; } time=0; fin=0; } }*root; void set(char *s) {原创 2014-08-06 19:41:28 · 494 阅读 · 0 评论 -
POJ - Colored Sticks - 并查集+字典树
字典树+并查集一道比较不错的题,欧拉图,值得一做原创 2014-08-16 14:01:20 · 836 阅读 · 0 评论