
字典树
文章平均质量分 70
wsxsd94
这个作者很懒,什么都没留下…
展开
-
Hdu1075 - What Are You Talking About - 字典树
#include#includestruct 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 · 550 阅读 · 0 评论 -
Hdu1251 - 统计难题 - 字典树
#include#includestruct 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 · 461 阅读 · 0 评论 -
Hdu1800 - Flying to the Mars - 字典树
#includechar 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 · 432 阅读 · 0 评论 -
POJ1204 - Word Puzzles - 字典树
#include#includechar 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 · 509 阅读 · 0 评论 -
Hdu1247 - Hat’s Words - 字典树
#include#includechar 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 · 457 阅读 · 0 评论 -
Hdu1298 - T9 - 字典树
#include#includechar 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 · 479 阅读 · 0 评论 -
POJ2503 - Babelfish - 字典树
#include#includestruct 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 · 455 阅读 · 0 评论 -
POJ2001 - Shortest Prefixes - 字典树
#include#includechar 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 · 503 阅读 · 0 评论 -
POJ - Colored Sticks - 并查集+字典树
字典树+并查集一道比较不错的题,欧拉图,值得一做原创 2014-08-16 14:01:20 · 855 阅读 · 0 评论