# bzoj3527:[Zjoi2014]力

### 传送门

$F_j=\sum_{i<j}\frac{q_iq_j}{(i-j)^2}-\sum_{i>j}\frac{q_iq_j}{(i-j)^2}\\ E_j=\frac{\sum_{i<j}\frac{q_iq_j}{(i-j)^2}-\sum_{i>j}\frac{q_iq_j}{(i-j)^2}}{q_j}\\ =\sum_{i<j}\frac{q_i}{(i-j)^2}-\sum_{i>j}\frac{q_i}{(i-j)^2}$

$a_i=\frac{1}{i^2}\\ p_i=q_{n-i+1}$

$E_j=\sum_{i=1}^{j-1}q_ia_{j-i}-\sum_{i=j+1}^{n}q_ia_{i-j}\\ E_j=\sum_{i=1}^{j-1}q_ia_{j-i}-\sum_{i=j+1}^{n}p_{n-i+1}a_{i-j}\\ E_j=\sum_{i=1}^{j-1}q_ia_{j-i}-\sum_{i=1}^{n-j}p_{n-j-i+1}a_i\\$

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
char ch; bool ok;
for(ok=0,ch=getchar(); !isdigit(ch); ch=getchar()) if(ch=='-') ok=1;
for(x=0; isdigit(ch); x=x*10+ch-'0',ch=getchar()); if(ok) x=-x;
}
#define rg register
const int maxn=4e5+10;const double pi=acos(-1);
int n,len,m,nn,r[maxn];
struct complex{double x,y;}a[maxn],b[maxn],c[maxn];
complex operator-(complex a,complex b){return (complex){a.x-b.x,a.y-b.y};}
complex operator+(complex a,complex b){return (complex){a.x+b.x,a.y+b.y};}
complex operator*(complex a,complex b){return (complex){a.x*b.x-a.y*b.y,a.y*b.x+b.y*a.x};}
void fft(complex *a,int f)
{
for(rg int i=0;i<n;i++)if(r[i]>i)swap(a[r[i]],a[i]);
for(rg int i=1;i<n;i<<=1)
{
complex wn=(complex){cos(pi/i),f*sin(pi/i)};
for(rg int j=0;j<n;j+=(i<<1))
{
complex w=(complex){1,0};
for(rg int k=0;k<i;k++)
{
complex x=a[j+k],y=w*a[j+k+i];
a[j+k]=x+y,a[j+k+i]=x-y,w=w*wn;
}
}
}
if(f==-1)for(rg int i=0;i<n;i++)a[i].x=a[i].x/n;
}
int main()
{
}