Want to try solving this problem? You can submit your code online if you log in or register.
Ishraq and Clement have lost their coconut and need help finding it again!
Ishraq, Clement and the coconut are standing on a 2d-plane. The locations of Ishraq and Clement are given by their x- and y-coordinates, where x and y are whole numbers.
Both Ishraq and Clement think they know how far away from the coconut they are, but in their sadness their memory may be wrong. Given the location of Ishraq and Clement, and their respective distances to the coconut, figure out whether there is at least one location that the coconut could be. Note that the distance from each person to the coconut will also be a whole number.
The first line will contain Ishraq's location, followed by his distance to the coconut; I_{x}, I_{y} and I_{d} respectively. The second line will contain Clement's location, followed by his distance to the coconut; C_{x}, C_{y} and C_{d} respectively.
If there is at least one location that the coconut could be in, your program should output 'yes', otherwise it should output 'no'.
1 2 3 6 8 4
no
The circles in the diagram give the points where the coconut could be given Ishraq and Clement's distances. Since these circles share no points there are no places where the coconut could be, so the result is 'no'.
0 0 15 17 6 10
yes
Given the diagram, we can see that there are two points that are distance 15 from Ishraq at (0,0) and distance 10 from Clement at (17,6). Their actual locations do not matter, we only need to determine if possible locations exist, so the result is 'yes'.
0 0 5 6 8 5
yes
There is exactly one possible location for the coconut (3, 4), so the answer is 'yes'.
1 1 10 1 2 3
no
In this case Clement's circle lies completely inside Ishraq's, so there is no possible place for the coconut to be. Therefore the answer is 'no'.
For all cases, 0 < I_{x}, I_{y}, I_{d}, C_{x}, C_{y}, C_{d} < 10,000.
Privacy
statement
© Australian Mathematics Trust 2001-2022
Page generated: 2 October 2022, 10:52am AEDT