10386 - Circles in Triangle
Posted: Sun Nov 03, 2002 3:16 pm
I have no idea how to solve this kinds of problems, can anybody help me plz
thanks
thanks
Code: Select all
/***********************/
#define PREC 1.0e-8
int main()
{
int N;
double pi,l,h,m,Y,r,s,m1,m2;
pi = acos(-1.0);
scanf("%d",&N);
r = 1;
/* l = pi * 24 / 180.0;
h = pi * 25 / 180.0;
while(h-l>=PREC)
{
m = (l + h)/2.0;
Y = r + r*cos(pi/3.0 - m) - 2*r*cos(m);
if(Y > 0.0)
{
h = m;
}
else
{
l = m;
}
}
*/
m2 = 0.43171784545542;
/* l = pi * 43 / 180.0;
h = pi * 44 / 180.0;
while(h-l>=PREC)
{
m = (l + h)/2.0;
Y = r + 2*r*cos(pi/3.0 - m) - 4*r*cos(m);
if(Y > 0.0)
{
h = m;
}
else
{
l = m;
}
}
*/
m1 = 0.75435478480197;
while(N--)
{
scanf("%lf",&r);
s = 8*r*cos(m1) + 2*sqrt(3.0)*r;
printf("%.10lf",s);
s = 2*r*sqrt(3.0) + 8*r*cos(m2);
printf(" %.10lf\n",s);
}
return 0;
}