Canadian Computing Competition: 2006 Stage 2, Day 1, Problem 2
Years ago, Romy and Jules were separated by their parents and forbidden to see each other ever again. However, using a tin-can telephone, their love survived and they were able to maintain their relationship. But, as time passed, some things changed and some things remained the same, Romy's great (times
To prevent Julia and Romian from seeing each other, their parents put them both on spaceships with no long-range communication facilities. Thus, Romian and Julia must use a laser to send each other messages using morse-code. In Romian and Julia's time, messages can be sent infinite distances through space using a laser, as long as the route between the sender and receiver is not blocked. Since this is the future, lasers can travel instantly across the universe. Therefore, you may assume that planets and spaceships remain stationary.
For this question, you are to determine whether Romian and Julia can communicate with each other (by laser) when given the
Input Specification
For input you will be given, on two lines, the grid coordinates of Romian's and Julia's spaceships. Each coordinate will consist of three, whitespace separated, integer values. Then, following the locations of their spaceships, the input will consist of a line containing a single integer
The coordinates of the
You may assume
You may also make the following assumptions:
Neither Romian or Juliet are within
Romian and Juliet do not occupy the same position in space (otherwise, their spaceships have crashed into each other and they will be consumed by an intergalactic explosion of epic proportions).
If the laser hits a planet, it would also have hit a planet with a radius which was
Output Specification
As output, you are to print a single integer, the number of planets that block the laser.
Sample Input
100 100 100
-100 -100 -100
2
0 0 0 2
50 60 -50 5
Sample Output
1
Comments