#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define pi acos(-1.0)
using namespace std;
int main(){
double r1, r2, r3;
double t1, t2, t3;
double porishima, area_triangle, angle_circle1, angle_circle2, angle_circle3;
int t;
cin >> t;
while(t--){
cin >> r1 >> r2 >> r3;
t1 = r2 + r3; t2 = r1 + r3; t3 = r1 + r2;
porishima = (t1+t2+t3) / 2;
area_triangle = sqrt(porishima * (porishima-t1) * (porishima-t2) * (porishima-t3));
angle_circle1 = acos((t2*t2+t3*t3-t1*t1)/(2*t2*t3));
angle_circle2 = acos((t1*t1+t3*t3-t2*t2)/(2*t1*t3));
angle_circle3 = (pi - (angle_circle1 + angle_circle2));
double area_circle = angle_circle1*r1*r1 + angle_circle2*r2*r2 + angle_circle3*r3*r3;
cout << fixed << setprecision(6) << area_triangle - area_circle/2 << endl;
}
return 0;
}
#include <algorithm>
#include <cmath>
#include <iomanip>
#define pi acos(-1.0)
using namespace std;
int main(){
double r1, r2, r3;
double t1, t2, t3;
double porishima, area_triangle, angle_circle1, angle_circle2, angle_circle3;
int t;
cin >> t;
while(t--){
cin >> r1 >> r2 >> r3;
t1 = r2 + r3; t2 = r1 + r3; t3 = r1 + r2;
porishima = (t1+t2+t3) / 2;
area_triangle = sqrt(porishima * (porishima-t1) * (porishima-t2) * (porishima-t3));
angle_circle1 = acos((t2*t2+t3*t3-t1*t1)/(2*t2*t3));
angle_circle2 = acos((t1*t1+t3*t3-t2*t2)/(2*t1*t3));
angle_circle3 = (pi - (angle_circle1 + angle_circle2));
double area_circle = angle_circle1*r1*r1 + angle_circle2*r2*r2 + angle_circle3*r3*r3;
cout << fixed << setprecision(6) << area_triangle - area_circle/2 << endl;
}
return 0;
}
No comments:
Post a Comment