I've tried 4 different methods:
1) Estimating rope length using binary search
2) Estimating angle between radii of both circles using binary search
2) Estimating angle between radii of both circles using Newton Raphson
3) Estimating rope length using binary search (another formulation)
All 4 methods give me the WA.
If possible, can someone please answer my queries:
1) What are the parameters for floating point? I use:
long double
epsilon = 1e-6
pi = 3.14159
2) Is p supposed to be printed to 2 dp or do I print it as it is given in the input?
3) When I print the rope length to 2 dp, can I simply use:
printf("%.2llf", rope);
or do I have to use a special formatting function?
ie: round up at >= 0.005
If possible, can someone please verify my test data?
test data:
Code: Select all
15
50 0.0
100 0.2
1000 0.25
1000 0.50
999 0.49
958 0.24
434 0.12
4546 0.23545
6534 0.2355
54654 0.2356
934959 0.25656
459876 0.4377834
213 0.111
456 0.23
34 0.1
my output:
Code: Select all
R = 50, P = 0.00, Rope = 0.00
R = 100, P = 0.20, Rope = 68.48
R = 1000, P = 0.25, Rope = 774.75
R = 1000, P = 0.50, Rope = 1158.73
R = 999, P = 0.49, Rope = 1143.33
R = 958, P = 0.24, Rope = 725.53
R = 434, P = 0.12, Rope = 225.50
R = 4546, P = 0.24, Rope = 3406.47
R = 6534, P = 0.24, Rope = 4896.73
R = 54654, P = 0.24, Rope = 40968.59
R = 934959, P = 0.26, Rope = 734915.30
R = 459876, P = 0.44, Rope = 491686.08
R = 213, P = 0.11, Rope = 106.17
R = 456, P = 0.23, Rope = 337.29
R = 34, P = 0.10, Rope = 16.03