The Universe, the Galaxies, and the Stars
Problem: There is 1 named universe which has 0 < n < 10 galaxies in it. Each galaxy has a name and 1 <= n < 10 possible stars in it. But, we need to find if the stars can be considered part of them. For a star to be considered part of a galaxy, its co-ordinates must be within the specified number of units in the X, Y, and Z planes. The number of stars in each galaxy must be known, along with their name.
Input: The first line of input is the name of the Universe, which is a single word with less than 10 characters in length. The second line of input is the number of galaxies in the universe. The third line is the name of a galaxy, which is also a single word with less than 10 characters in length. The fourth line is the XYZ co-ordinates of the center of the galaxy. Each co-ordinate value is -255 >= XYZ <= 255 The fifth line is the distance allowed in any plane from the center of the galaxy. The sixth line is number of stars to be tested if they are part of the galaxy. The nth line is the XYZ co-ordinates of the star(s). The input ends when all the co-ordinates are 0.
code: |
Sample Input:
Haskell
2
Lyman
100 3 10
60
4
0 20 2
4 56 89
99 5 5
100 200 4
Break
200 4 60
34
2
250 3 10
2 5 7
0 0 0 |
Output: The first line of output must be the name of the universe. The 2nd to nth line must be the name of a galaxy, with the number of stars within it next to the name.
code: |
Sample Output:
Haskell
Lyman 1
Break 0 |