字典树都是跟的这个博客学的→:https://blog.csdn.net/qq_38891827/article/details/80532462
这些题目也都是他里面的题目,就是把题目按难度排了个序 + 自己整理了下思路(代码也差不多
主要是为了记录一下 忘了的话以后可以翻翻看hhh
模板
const int maxn = 1e5 + 10; int Next[maxn][26]; bool flag[maxn]; int tol; void Insert(char *s) { int len = strlen(s); int root = 0; for (int i = 0; i < len; i++) { int id = s[i] - 'a'; if (!Next[root][id]) tree[root][id] = ++tot; root = Next[root][id]; } flag[root] = true; } bool Find(char *s) { int len = strlen(s); int root = 0; for (int i = 0; i < len; i++) { int id = s[i] - 'a'; if (!Next[root][id]) return false; root = Next[root][id]; } return true; }