Pagini recente » Cod sursa (job #457222) | Cod sursa (job #1312467) | Cod sursa (job #3132529) | Cod sursa (job #1673785) | Cod sursa (job #1010463)
#include<fstream>
#include<cstring>
#define NMax 20050
using namespace std;
char s[NMax];
long long N, Sol;
void Read()
{
ifstream fin("pscpld.in");
fin.getline(s+1, NMax);
N=strlen(s+1);
}
int Expand (int Left, int Right)
{
int Length=0;
while (Left>0 and Right<=N and X[Left]==X[Right])
{
--Left, ++Right, ++Length;
}
return Length;
}
void Solve()
{
void SolveUneven ()
{
int P=0, R=0;
for (int i=1; i<=N; ++i)
{
int Left, Right;
if (R>=i)
{
DP[i]=min (DP[P-(i-P)], R-i);
}
Left=i-DP[i];
Right=i+DP[i];
DP[i]+=Expand (Left, Right);
if (i+DP[i]>R)
{
P=i;
R=i+DP[i];
}
S+=((long long)DP[i]);
}
}
}
void Print()
{
ofstream fout("pscpld.out");
fout<<Sol<<endl;
}
int main()
{
Read();
Solve();
Print();
return 0;
}