#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
int max(int a,int b){return a<b?b:a;}
int min(int a,int b){return a>b?b:a;}
int main()
{
int cas,t=1;
cin>>cas;
while(cas--)
{
double a,b,c,d;
{
cin>>a>>b>>c>>d;
bool f=1;
double s=(a+b+c+d)/2;
double ans=sqrt((s-a)*(s-b)*(s-c)*(s-d));
if(a>=b+c+d || b>=a+c+d || c>=a+b+d || d>=a+b+c)
printf("Case %d: -1\n",t++);
else
printf("Case %d: %.6lf\n",t++,ans);
}
}
return 0;
}
详细证明 : http://www.doc88.com/p-792551521271.html
具体就是海伦公式水过