SHARE
TWEET

lightoj - 1331 - Agent J

jakaria_hossain Aug 23rd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int test;
  6.     cin>>test;
  7.     for(int t=1;t<=test;t++)
  8.     {
  9.         double r1,r2,r3,a,b,c,s,A,B,C,area,result;
  10.         cin>>r1>>r2>>r3;
  11.         a=r1+r2;
  12.         b=r2+r3;
  13.         c=r3+r1;
  14.         s=(a+b+c)/2;
  15.         area=sqrt(s*(s-a)*(s-b)*(s-c));
  16.         A=acos((a*a+c*c-b*b)/(2.0*a*c));
  17.         B=acos((a*a+b*b-c*c)/(2.0*a*b));
  18.         C=acos((b*b+c*c-a*a)/(2.0*b*c));
  19.         result=area-A*r1*r1/2-B*r2*r2/2-C*r3*r3/2;
  20.         cout<<"Case "<<t<<": "<<setprecision(9)<<fixed<<result<<endl;
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top