Skip to main content

solution of -CIRCLE_E - Three Circle Problem (EASY) on spoj

solution-

Given 3 distinct circles with positive integer radius R1R2, and R3, and arranged like in the picture below:
Now, your task is to compute radius of small circle that can be created like yellow circle in the picture above. All circles in the picture above tangent each other.

Input-

The first line in the input data, there is an integer T(0 < T ≤ 103) denoting number of test cases, than T lines follow.
For each lines, there are three integer R1R2, and R3, (0 < {R1,R2,R3} < 109) denoting radius of each circle like in the picture above.

ATTENTION-

take input in float-
SYNTAX-


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{double a,b,c,t;
double r;
scanf("%lf",&t);
while(t--)
{
scanf("%lf%lf%lf",&a,&b,&c);
if(a>0&&b>0&&c>0)
{ r=a*b*c/(2*sqrt(a*b*c*(a+b+c))+a*b+b*c+c*a);
printf("%lf\n",r);
}
}
}

Comments

Popular posts from this blog

solution of TRICOUNT - Counting Triangles on spoj

  TRICOUNT - Counting Triangles solution- #include<stdio.h> int main() {     int t;     scanf("%d",&t);     while(t--)     {         long long unsigned num,sum;         scanf("%llu",&num);         if(num%2==0)         sum=(num*(num+2)*((2*num)+1))/8;         else         sum=((num*(num+2)*((2*num)+1))-1)/8;         printf("%llu\n",sum);     }     return 0; }

solution of PRIME1 - Prime Generator on spoj

PRIME1 - Prime Generator solution- #include<stdio.h> #include<math.h> int main() {int t; long long int l,h,i,flag; scanf("%d",&t); while(t--) { scanf("%lld%lld",&l,&h); while(l<=h) { flag=0; for(i=2;i<=sqrt(l);i++) { if(l%i==0) { flag=1;     break; } } if(flag==0) { if(l!=1) printf("%lld\n",l); } l++; } printf("\n"); } return 0; }