mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
21 lines
423 B
C++
21 lines
423 B
C++
|
#include<iostream>
|
||
|
#include<cstdio>
|
||
|
#include<cstring>
|
||
|
using namespace std;
|
||
|
int n,num[1010];
|
||
|
int main(){
|
||
|
int t;
|
||
|
scanf("%d",&t);
|
||
|
while(t--){
|
||
|
scanf("%d",&n);
|
||
|
int ans=0;
|
||
|
for(int i=0;i<n;i++){
|
||
|
scanf("%d",&num[i]);
|
||
|
ans+=1*num[i]*(n-1-num[i]);
|
||
|
}
|
||
|
ans/=2;
|
||
|
printf("%.3f\n",1.0-ans*1.0/((n*(n-1)*(n-2))/6));
|
||
|
}
|
||
|
return 0;
|
||
|
}
|