Advertisement
erfanul007

LOJ 1331

Apr 14th, 2021
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main() {
  4.     double r1,r2,r3,x,y,z,X,Xr,Y,Yr,Z,Zr,tarea,s,area;
  5.     int n,i;
  6.     scanf("%d",&n);
  7.     for(i=1;i<=n;i++){
  8.         scanf("%lf%lf%lf",&r1,&r2,&r3);
  9.         x = r2 + r3;
  10.         y = r1 + r3;
  11.         z = r1 + r2;
  12.         s = (x+y+z)/2;
  13.         tarea = sqrt(s*(s-x)*(s-y)*(s-z));
  14.         X = acos((y*y+z*z-x*x)/(2*y*z));
  15.         Y = acos((z*z+x*x-y*y)/(2*x*z));
  16.         Z = acos((x*x+y*y-z*z)/(2*x*y));
  17.         area = tarea - (0.5)*(r1*r1*X+r2*r2*Y+r3*r3*Z);
  18.         printf("Case %d: %.08lf\n",i,area);
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement