Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <cmath>
- using namespace std;
- double theta(double a,double b,double c)
- {
- double ang=0;
- ang += acos(((a*a)+(b*b)-(c*c))/(2*a*b));
- return ang;
- }
- int main()
- {
- int tc,c=1;
- cin >> tc;
- while(tc--)
- {
- double r1,r2,r3,x,y,z;
- cin >> r1 >> r2 >> r3;
- x = r1+r2;
- y = r2+r3;
- z = r1+r3;
- double peri_tri, s;
- peri_tri = x+y+z;
- s = peri_tri/2;
- double area_t = 0;
- area_t += sqrt(s*(s-x)*(s-y)*(s-z));
- double sector_c = 0;
- sector_c += (.5*r1*r1*theta(x,y,z))+(.5*r2*r2*theta(y,z,x))+(.5*r3*r3*theta(x,z,y));
- double area_d = 0;
- area_d += area_t - sector_c;
- printf("Case %d: %lf\n",c++,area_d);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement