mhdew

Contest 4_C

Feb 15th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int i, t;
  6. double R1,R2,R3;
  7. double r1,r2,r3;
  8. double a,b,c,ara,arb,arc;
  9. double tra_area,arc_area,area;
  10. double s;
  11.  
  12. int main()
  13. {
  14. scanf("%d", &t);
  15. for(i=1;i<=t;i++){
  16. scanf("%lf%lf%lf", &R1,&R2,&R3);
  17.  
  18. r1=R2+R3;
  19. r2=R1+R3;
  20. r3=R1+R2;
  21.  
  22. a=(r2*r2+r3*r3-r1*r1)/(2*r2*r3);
  23. a=acos(a);
  24. b=(r1*r1+r3*r3-r2*r2)/(2*r1*r3);
  25. b=acos(b);
  26. c=(r1*r1+r2*r2-r3*r3)/(2*r1*r2);
  27. c=acos(c);
  28.  
  29. ara=(R1*R1*a)/2;
  30. arb=(R2*R2*b)/2;
  31. arc=(R3*R3*c)/2;
  32.  
  33. arc_area=ara+arb+arc;
  34.  
  35. s=r1+r2+r3;
  36. s=s/2;
  37.  
  38. tra_area=sqrt(s*(s-r1)*(s-r2)*(s-r3));
  39.  
  40. area=tra_area-arc_area;
  41.  
  42. printf("Case %d: %.10lf\n", i,area);
  43. }
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment