/**
[字典树]poj 1451 T9
在hdu 1298 上WA了。
*/
#include <stdio.h>
#include <string.h>
#define N 50000
struct tireTree
{
int cnt;
tireTree *child[26];
}tt[N],*spt;
void insert(char *s,int p,tireTree *&rt)
{
tireTree *loc;
loc = rt;
int num;
for(int i = 0; s[i]; ++i)
{
num = s[i] - 'a';
if(loc->child[num] == NULL)
loc->child[num] = spt++;
loc = loc->child[num];
loc->cnt += p;
}
}
char t9[10][6] = {",",",","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
char wr[11],word[13][13];
char s[11];
int pp[11];
void query(tireTree *rt,int t)
{
if(t > 0)
{
if(rt->cnt > pp[t-1])
{
pp[t-1] = rt->cnt;
for(int i = 0; i &l
[字典树]poj 1451 T9
最新推荐文章于 2019-10-05 10:43:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)