Trie的写法是很灵活的,感觉跟segment tree一样,要活用
/*
PROG: 统计难题
ID :
LANG: C++
*/
#include <string>
#include <cstdio>
#include <cstdlib>
#include <memory.h>
#include <iostream>
#include <algorithm>
using namespace std;
struct Trie_Node
{
int cnt;
Trie_Node *branch[27];
Trie_Node():cnt( 0 )
{
memset( branch, 0, sizeof(branch) );
}// Init
};
class Trie
{
public:
Trie();
void Trie_Insert( char ss[] );
int Trie_Find( char ss[] );
private:
Trie_Node *root;
}t;
Trie::Trie()
{
root = new Trie_Node(