Gleaming the Cubes |
As chief engineer of the Starship Interprize, the task of repairing the hyperstellar, cubic, transwarped-out software has fallen on your shoulders. Simply put, you must compute the volume of the intersection of anywhere from 2 to 1000 cubes.
Following the data for the first set of cubes will be a number which indicates
how many cubes are in a second set, followed by the cube descriptions for the
second set, again one per line. Following this will be a third set, and so on.
Your program should continue to process sets of cubes, outputting the volume of
their intersections to the output file, one set per line, until a zero is read
for the number of cubes.
Note that the data file will always contain at least one set of cubes, and
every set will contain at least 2 and at most 1000 cubes. For any given set of
cubes, the volume of their intersections will not exceed 1,000,000 units.
2 0 0 0 10 9 1 1 5 3 0 0 0 10 9 1 1 5 8 2 2 3 0
25 9