摘要:ac自动机+dp#include<iostream>#include<fstream>using namespace std;struct e{ int p[5]; int end;}trie[1001];int n,m,K;int hash[300];int state=1;int f[1001];void build(char c[]){ int i,j=0,k; for(i=1;;) { if(trie[i].p[hash[c[j]]]==0) trie[i].p[hash[c[j]]]=++state; i=trie[i].p[hash[c[j]]]; j++;
阅读全文
摘要:自动机+矩阵乘。代码:#include<iostream>#include<fstream>using namespace std;struct e{ int p[5]; int end;}trie[101];int m,K,n;int hash[128];int state=1;long long s;int f[101];void build(char c[]){ int i,j=0,k; for(i=1;;) { if(trie[i].p[hash[c[j]]]==0) trie[i].p[hash[c[j]]]=++state; i=trie[i].p[hash
阅读全文
摘要:ac自动机+高精+dp高精输出适用了cout.wide cout.fill('0');代码:#include<iostream>#include<fstream>using namespace std;struct e{ int p[51]; int end;}trie[501];int n,m,K;int hash[600];int state=1;int f[501];void build(char c[]){ int i,j=0,k; for(i=1;;) { if(trie[i].p[hash[c[j]]]==0) trie[i].p[hash[
阅读全文