不多说,给你三角形三边长,求内切圆半径,够简单吧?但是你肯定会wa的。因为边长有=0的情况。悲剧啊。。。。
代码:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
double a, b, c;
while (scanf("%lf %lf %lf", &a, &b, &c) != EOF)
{
if(0==a || 0==b || 0==c)
{
printf("The radius of the round table is: 0.000\n");
continue;
}
printf("The radius of the round table is: %.3lf\n", a * b * sin(acos((a * a + b * b - c * c) / (2.0 * a * b))) / (a + b + c));
}
return 0;
}