Tuesday, April 28, 2015

UVa - 10195 - The Knights Of The Round Table

#include <bits/stdc++.h>
#define scI(n) scanf("%d", &n)
#define scL(n) scanf("%lld", &n)
#define scS(n) scanf("%s", &n)
#define mn(n, m) (n > m)?m:n
#define mx(n, m) (n < m)?m:n
#define S 53
using namespace std;
typedef long long LL;

int dirX[] = {1, 0, -1, 0, -1, 1, 1, -1};
int dirY[] = {0, 1, 0, -1, -1, 1, -1, 1};

int main(){
    double a, b, c, p, ar, r;
    while(scanf("%lf %lf %lf", &a, &b, &c) == 3){
        if(!a || !b || !c){
            printf("The radius of the round table is: 0.000\n");
            continue;
        }
        p = (a+b+c)/2.0;
        ar = sqrt(p*(p-a)*(p-b)*(p-c));
        r = ar/p;
        printf("The radius of the round table is: %.3lf\n", r);
    }
    return 0;
}

No comments:

Post a Comment