简直醉了。
1)对于一般的三角形,内切圆半径公式如下:
[(s-a)(s-b)(s-c)/s]^(1/2)
s=(a+b+c)/2
2)在直角三角形的内切圆中,有这样两个简便
公式:
1、两直角边相加的和减去斜边后除以2,得数是内切圆的半径:
r=(a+b-c)/2(注:s是Rt△的面积,a, b是Rt△的2个直角边,c是斜边)
2、两直角边乘积除以直角三角形周长,得数是内切圆的半径:
r=ab/ (a+b+c)
内切圆的半径公式:a,b,c为三角形三条边
s = (a + b + c) / 2;
r = sqrt( (s-a)*(s-b)*(s-c)/s);
这样的话,我们可以根据边之间比例,用一个边把另外2条边表示出来,之后带入内切圆的公式。
海伦公式求面积
Area = sqrt(s * (s - a) * (s - b) * (s - c));
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
const double eps = 1e-10;
#define _PI acos(-1.0)
double m1,n1,m2,n2,m3,n3;
double t1,t2,t3,t4,t5,t6;
double r,b;
void init(){
scanf("%lf",&r);
scanf("%lf%lf%lf%lf%lf%lf",&m1,&n1,&m2,&n2,&m3,&n3);
double t1 = n3 / (n3 + m3);
double t2 = m1 / (n1 + m1);
double t3 = m3 / (n3 + m3);
double t4 = n2 / (n2 + m2);
double k1 = t1 / t2; // c = k1 * b
double k2 = t3 / t4; // a = k2 * b
double k = k1 + k2 + 1; // 周长 = a + b + c = (k1 + k2 + 1) * b;
double _k = k / 2;
double tt = (_k - k1)*(_k - k2)*(_k - 1);
b = sqrt(r * r * _k / tt);
double S = _k * b;
double ans = sqrt(S * (S - k1 * b) * (S - b) * (S - k2 * b));
printf("%.4f\n",ans);
}
int main(){
int T;
scanf("%d",&T);
while(T--){
init();
}
return 0;
}