摘要:
题目链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=1671动态分配内存,当实例较多时需释放内存,不然会超空间#include<iostream>#include<string>#include<cstdio>using namespace std;#define maxn 10001char s[maxn][11];struct Trie{ Trie *next[10]; Trie() { memset(next,0,sizeof(next)); }};void Insert(Trie *root,char . 阅读全文
posted @ 2012-10-28 15:02
sorryhao
阅读(167)
评论(0)
推荐(0)
摘要:
方法一:字典树515ms#include<iostream>#include<string>using namespace std;struct Trie{ string s; //在每个单词的末尾节点上保存该单词的英语意思 Trie *next[26]; Trie() { s = ""; memset(next,0,sizeof(next)); }};void Insert(Trie *root,string s1,string s2){ Trie *p = root; for(int i = 0; i < s2.si... 阅读全文
posted @ 2012-10-28 13:09
sorryhao
阅读(230)
评论(0)
推荐(0)

浙公网安备 33010602011771号