/**
[字典树]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
[字典树]poj 1451 T9
最新推荐文章于 2021-04-10 09:59:56 发布