首页 > 其他 > 详细

test

时间:2018-11-06 21:49:51      阅读:114      评论:0      收藏:0      [点我收藏+]
#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

test

原文:https://www.cnblogs.com/Draymonder/p/9918322.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!