Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************
- * Bismillahir Rahmanir Rahim
- * Harunur Rashid
- ********************************
- ************Template Starts Here***********/
- #include<bits/stdc++.h>
- using namespace std;
- #define endl "\n"
- #define eps 1e-9
- #define sf scanf
- #define xx first
- #define yy second
- #define pf printf
- #define ppb pop_back
- #define sqr(x) ((x)*(x))
- #define mp make_pair
- #define pb push_back
- #define pi acos(-1.0)
- #define mod 1000000007
- #define pr(a) cout<<a<<"\n"
- #define sz(x) ((int)x.size())
- #define all(a) a.begin(),a.end()
- #define mem(a,b) memset(a,b,sizeof(a))
- #define lcm(a,b) (abs(a)/gcd(a,b))*abs(b)
- typedef long long int lld;
- typedef unsigned long long int llu;
- typedef vector<int> vi;
- typedef pair<int,int> pii;
- template<class T>
- T mod_f(T num)
- {
- if(num>=0) return num%mod;
- else return ((num%mod)+mod)%mod;
- }
- template<class T>
- T fast_pow(T b,T p)
- {
- if(p==0)
- return 1;
- if(p%2)
- {
- T x=mod_f(mod_f(b)*mod_f(fast_pow(b,p-1)));
- return x;
- }
- else
- {
- T x=mod_f(fast_pow(b,p/2));
- x=mod_f(mod_f(x)*mod_f(x));
- return x;
- }
- }
- template<class T>
- T gcd(T a,T b)
- {
- a=abs(a);
- b=abs(b);
- while(b)
- {
- T r=a%b;
- a=b;
- b=r;
- }
- return a;
- }
- /*/ 4 direction ....
- int dx[]= {+0,+1,+0,-1};
- int dy[]= {+1,+0,-1,+0};
- // 8 direction ....
- int dx[]= {+0,+1,+1,+1,+0,-1,-1,-1};
- int dy[]= {+1,+1,+0,-1,-1,-1,+0,+1};
- // Knight direction...
- int dx[]= {+1,-1,+2,-2,+2,-2,+1,-1};
- int dy[]= {+2,+2,+1,+1,-1,-1,-2,-2};
- */
- /***********Template Ends Here***********/
- double area(double a,double b,double c)
- {
- double s=(a+b+c)/2;
- return sqrt(s*(s-a)*(s-b)*(s-c));
- }
- int main()
- {
- int T;
- double r1,r2,r3,A,low,high,r,X,Y,Z;
- scanf("%d",&T);
- while(T--)
- {
- scanf("%lf%lf%lf",&r1,&r2,&r3);
- A=area(r1+r2,r1+r3,r2+r3);
- low=0;
- high=1000000000;
- while(high-low>eps)
- {
- r=(low+high)/2;
- X=area(r1+r2,r1+r,r2+r);
- Y=area(r1+r3,r1+r,r3+r);
- Z=area(r2+r3,r2+r,r3+r);
- if(X+Y+Z<A) low=r;
- else high=r;
- }
- printf("%.6lf\n",r);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement