题意:
给出n个串,n个串可以任意两两组合,求回文的个数。
题解:
纯恶心的题目,完全没有意义,全部操作只能在一个字符数组上处理,相当于一个字符数组成为n个串的公用。
代码还没写完。。。。
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<map>
using namespace std;
//typedef long long lld;
const int oo=0x3f3f3f3f;
//const lld OO=1LL<<61;
const int MOD=10007;
const int maxn=2000000+10;
char str[maxn];
int bg[maxn],ed[maxn];
int next[maxn],extend[maxn];
int
struct Trie
{
struct TrieNode
{
int nCount;
bool f;
TrieNode* child[26];
TrieNode()
{
nCount=0;
f=false;
memset(child,NULL,sizeof child);
}
}* root;
void Insert(int num)
{
TireNode* p=root;
int j=bg[num];
for(int i=bg[num],k;i<=ed[num];i++)
{
k=str[i]-'a';
if(!p->child[k])
p->child[k]=new TrieNode();
p=p->child[k];
if(extend[j]+j==ed[num])
p->nCount++;
j++;
}
p->f=true;
}
int Search(int num)
{
TrieNode*p=root;
int leaf=0,j=bg[num];
for(int i=bg[num],k;i<=ed[num];i++)
{
k=str[i]-'a';
if(!p->child[k])
p=p->child[k];
if(p->f)
leaf++;
j++;
}
if(cnt>=len)///如果走完了
return p->nCount;
else///到了叶子节点还没走完
{
if(extend[j]+j==ed[num])
return leaf;
else
return 0;
}
}
};
void get_extend(char T[],int len,int x)
{
int k=0;
next[k]=len;
while(k<len-1&&T[k]==T[k+1])k++;
next[k],
}
void Ekmp(char S[],char T[],int lenS,int lenT,int x)
{
get_extend(T,lenT,x);
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
}
return 0;
}
/**
2
3
51 52 51
4
51 52 52 51
*/