I usually avoid this type of question. Some cubes have one side
touching the box, others have two sides touching the box, and the
cubes in the corners have three sides touching the box, so I've found
that you can go crazy trying to work it out.
But I just now had a flash as I was reading this one.
I stuck one simple operation into my calculator and got 384 cubes
NOT touching the box. So (864 - 384) = 480 cubes ARE touching.
Here's what I did:
-- You have this rectangular box, fully loaded with rows, columns,
and layers of tiny 1x1x1 cubies.
-- Now picture a smaller inside 'brick' of cubies that are just inside the
first layer, all around. It actually consists of all the cubies that are NOT
touching the box.
-- Each dimension of the inside 'brick' is 2 less than the full dimension
of the box.
For example, the height, say, is (18) minus (1 layer on the top) minus
(1 layer on the bottom) = 16 units.
Similarly, the length of the 'brick' is (8 - 2) = 6, and the width is (6 - 2) = 4.
-- So the volume of the small 'brick' just inside the surface layer is
(6 · 4 · 16) = 384 cubies.
-- The rest of the cubies in the box are the outer layer ... all the ones
that are touching the box.
We're told that the volume of the box is 864 .
So the ones touching the box must be (864 - 384) = 480 cubies.