/home/toolbox/public_html/solutions/106/10668/judged.c
1 /*
2 @JUDGE_ID: 47124AK 10668 C
3
4 coded for practice
5 date: 2004-07-13
6 problem: 10668
7 */
8
9 #include <stdio.h>
10
11 #define TRUE (1 == 1)
12 #define FALSE (1 != 1)
13 #define FUZZ (0.00000001)
14
15 double length;
16 double N;
17 double C;
18
19 int getInput()
20 {
21 /* BEGIN FUNCTION getInput */
22 scanf("%lf %lf %lf ", &length, &N, &C);
23 return ((0 <= length) || (0 <= N) || (0 <= C));
24 } /* END FUNCTION getInput */
25
26 void process()
27 {
28 /* BEGIN FUNCTION process */
29 double s;
30 double t1;
31 double k;
32 double delta;
33 double t;
34 double r;
35 double d;
36 double h;
37 double kk;
38
39 if (( FUZZ < length) && (FUZZ < N) && (FUZZ < C))
40 {
41 /* then */
42 /*
43 s = (1 + N * C) * length;
44 k = length / s
45 */
46
47 kk = 1 + N * C ;
48 k = 1 / kk;
49 s = kk * length;
50 t = sqrt(6 - 6*k);
51 delta = 1;
52 while (FUZZ < delta)
53 {
54 /* while */
55 t1 = t;
56 t = t1 - (sin(t1)-k*t1)/(cos(t1)-k);
57 delta = fabs(t - t1);
58 } /* while */
59
60 r = s / (2 * t);
61 d = r * cos(t);
62 h = r - d;
63 } /* then */
64 else
65 h = 0.0;
66
67 printf("%.3lf\n", h);
68 } /* END FUNCTION process */
69
70 int main ()
71 {
72 /* main */
73 int moreToDo;
74
75 moreToDo = getInput();
76 while (moreToDo)
77 {
78 /* while */
79 process();
80 moreToDo = getInput();
81 } /* while */
82
83 return 1;
84 } /* main */
85
86
87