fork(2) download
  1. #include<iostream>
  2. #include<cmath>
  3. #include<iomanip>
  4. using namespace std;
  5. int main(){
  6. int t;
  7. cin>>t;
  8. cout<<fixed<<setprecision(2);
  9. while(t--){
  10. double a,b,c,d,s,ar;
  11. cin>>a>>b>>c>>d;
  12. s=(double)((double)(a+b+c+d)/(double)2);
  13. ar=(double)(s-a)*(s-b)*(s-c)*(s-d);
  14. cout<<(double)sqrt(ar)<<endl;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 3464KB
stdin
2
1 2 1 2
0.5 0.5 0.5 0.5
stdout
2.00
0.25