這個好像叫做海龍公式的樣子...。
//ignore header files
int main(int argc, char const* argv[])
{
int n;
scanf("%d",&n);
double s[10005];
while(n--){
int m;
scanf("%d",&m);
for(int i = 0;i<m;i++){
double e;
scanf("%lf",&e);
s[i] = e;
}
sort(s,s+m);
double max = 0;
for(int i = m-1;i >= 2;i--){
double a = s[i];
double b = s[i-1];
double c = s[i-2];
if(a+b<c || a+c<b || b+c<a)
continue;
double p = (a+b+c)/2;
double s = p*(p-a)*(p-b)*(p-c);
if (s>max){
max = s;
}
}
printf("%.2lf\n",sqrt(max));
}
return 0;
}