LeeBlog

导航

2011年3月14日 #

HDU 1251 统计难题 字典树

摘要: 此题用字典树做,很快,据小白说还有一种方法:把每个单词的第一个字母存进去,然后再进行字符串比较,这样刚好不超时#include<stdio.h>#include<string.h>#include<stdlib.h>struct T{ T *ch[26]; int n;}rt;char in[30];void init( T *t ){ t -> n = 0; for( int i = 0; i < 26; ++i ) t -> ch[ i ] = NULL; }void insert( T *t,char *in ){ if( t -&g 阅读全文

posted @ 2011-03-14 22:09 LeeBlog 阅读(166) 评论(0) 推荐(0) 编辑