Friday, April 24, 2015

UVa - 10347 - Medians

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    double a, b, c, s, ans;
    while(cin >> a >> b >> c){
        s = (a+b+c) / 2;
        ans = (4 * sqrt(s*(s-a)*(s-b)*(s-c))) / 3;
        if(ans > 0 )cout << fixed << setprecision(3) << ans << endl;
        else cout << "-1.000" << endl;
    }
    return 0;
}

No comments:

Post a Comment