#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int main(){ int N; cin>>N; long long L; cin>>L; double PI = acos(-1.0); vector x(N),y(N); rep(i,N){ long long T; cin>>T; x[i] = cos(PI * 2.0 / L * T); y[i] = sin(PI * 2.0 / L * T); } double ans = 0.0; rep(i,N){ double temp = 0.0; vector theta(N-1),r(N-1); rep(j,N){ if(j==0)continue; int jj = j + i; jj %= N; r[j-1] = hypot(x[i]-x[jj],y[i]-y[jj]); theta[j-1] = atan2(y[jj]-y[i],x[jj]-x[i]); } int pos = 0; double sp = 0.0,cp = 0.0,sm = 0.0,cm = 0.0; int cntp = 0,cntm = 0; rep(j,N-1){ while(pos!=j){ if(sin(theta[j]-theta[pos])<=0.0){ cntp--; cntm++; sp -= sin(theta[pos])*r[pos]; cp -= cos(theta[pos])*r[pos]; sm += sin(theta[pos])*r[pos]; cm += cos(theta[pos])*r[pos]; pos++; } else break; } double ss = r[j] * sin(theta[j]),cc = r[j] * cos(theta[j]); double ttt = 0.0; if(j!=0){ ttt += ss * cp; ttt -= cc * sp; ttt -= ss * cm; ttt += cc * sm; //ttt *= cntp+cntm; } //cout<