标签:pre struct name oid turn http using class tps
#include <iostream> #include <cstring> #include <string> #include <queue> using namespace std; const int N = 1e6 + 10; char s[N]; node *root; struct node { node *nxt[26], *fail; int ok; node() { ok = 0; for(int i=0; i<26; i++) nxt[i]=NULL; fail=NULL; } }; void ins(char *s, int len) { node *rt = root; for(int i=0; i<len; i++) { int x= s[i]-‘a‘; if(rt->nxt[x] == NULL) rt->nxt[x] = new node(); rt= rt->nxt[x]; } rt->ok = 1; return ; } void build() { node *rt = root; rt->fail = rt; queue<node*> Q; Q.push(root); for(int i=0; i<26; i++) { } } int main() { root = new node(); int n; scanf("%d",&n); for(int i=0; i<n; i++) scanf("%s", s[i]), ins(s, strlen(s)); scanf("%s", s); return 0; }
https://hihocoder.com/contest/hiho4/problem/1
标签:pre struct name oid turn http using class tps
原文地址:https://www.cnblogs.com/Draymonder/p/9918322.html