http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=11815
如图给定r,r1,r2,r3.求三角习面积。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
double fun(double r,double rs)
{
double x=(rs*r+rs*rs)/(r-rs);
x=x+r+rs;
double gao=sqrt(x*x-r*r);
return gao*r*2/2.0;
}
int main()
{
double r,r1,r2,r3;
int ncase=1;
while(~scanf("%lf%lf%lf%lf",&r,&r1,&r2,&r3))
{
if(r<0) break;
double res=0;
res+=fun(r,r1);
res+=fun(r,r2);
res+=fun(r,r3);
printf("Case %d: %.2lf\n",ncase++,res);
}
return 0;
}