随笔分类 - 字符串-Trie
摘要:经典的字典树,debug爽歪歪。 Code: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int MAXN = 500000; 4 int ch[MAXN][26], tag[MAXN], tot = 1; 5 char word
阅读全文
摘要:Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a hi
阅读全文
摘要:题目: Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计
阅读全文
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 4 typedef struct TrieNode{ 5 bool flag; 6 TrieNode *next[26]; 7 TrieNode(){ 8 flag = false; 9 memse
阅读全文

浙公网安备 33010602011771号