1 // THREAD IN THE SPACE....
10 scanf("%lf %lf %lf", &(A
.x
), &(A
.y
), &(A
.z
));
12 double dist(point p1
, point p2
){
13 return sqrt((p1
.x
-p2
.x
)*(p1
.x
-p2
.x
)+(p1
.y
-p2
.y
)*(p1
.y
-p2
.y
) + (p1
.z
-p2
.z
)*(p1
.z
-p2
.z
));
16 double acos1(double x
){
20 while( res
< 0.0 ) res
+= 2.0*Pi
;
21 if( res
>= Pi
) res
= 2.0*Pi
- res
;
30 read(A
), read(B
), read(C
);
31 if( A
.x
== B
.x
&& A
.y
== B
.y
&& A
.z
== B
.z
){
41 double s
= (dab
+dbc
+dac
)/2.0;
42 double area
= sqrt(s
*(s
-dac
)*(s
-dbc
)*(s
-dab
));
43 double alt
= (area
*2.0)/dab
;
44 if( fabs(alt
-R
) < 1e-7 || alt
> R
){
45 printf("%.2lf\n", dab
);
48 if (((dac
*dac
+ 1e-7) >= (dab
*dab
+ dbc
*dbc
)) || ((dbc
*dbc
+1e-7) >= dab
*dab
+ dac
*dac
)){
50 printf("%.2lf\n", dab
);
54 l1
= sqrt(dac
*dac
- R
* R
);
55 l2
= sqrt(dbc
*dbc
- R
* R
);
56 double angleacb
, anglel1ca
, anglel2cb
;
60 angleacb
= acos1((c
*c
-a
*a
-b
*b
)/(-2.0*a
*b
));
62 c
= l1
, b
= R
, a
= dac
;
63 anglel1ca
= acos1((c
*c
-a
*a
-b
*b
)/(-2.0*a
*b
));
66 anglel2cb
= acos1((c
*c
-a
*a
-b
*b
)/(-2.0*a
*b
));
68 double alfa
= angleacb
- anglel1ca
- anglel2cb
;
70 double di
= (Pi
*(R
+R
)) * alfa
/ (2.*Pi
);
72 printf("%.2lf\n",( di
+ l1
+ l2
));