The reason why I re-labelled the cube to 4x5x8 was to work with 'units' rather than length. To see what I mean look at the image that I uploaded. Let's say that the length of each side is 90 cm, and say that each individual small cube has a length of 30 cm. We can either describe the cube in terms of its total length i.e. 90x90x90, or we can describe it in terms of the number of cubes it contains i.e. 3x3x3. So the cube contains 27 little cubes.
In the example in the question, the cube has dimensions 80cmx100cmx160cm. We then determined that each individual cube has dimension 20cmx20cmx20cm. Therefore, one side of the cuboid will be able to fit a maximum of 4 cubes (since 80/20=4), one side will be able to fit 5 (100/20=5), and one side will fit 8 (160/20=8).
The reason why we decide to do this is that we no longer care about the total dimension of the original cuboid since we have cut it up into cubes, so essentially we just want to know how many cubes there are and how many sides of them we want to paint. So we are in a way 'dismantling' the cuboid to just leave over the individual cubes.
To determine the number of cubes in the center, it is helpful to work the other. Imagine you have a 2x2 cube, and that you want to add an extra 'layer' on top of it. You will have to place a cube on top of every cube, and this will increase the dimension of each side by 2. In the cube in the picture, if you add a cube over all the existing cubes, the resulting cube will have a dimension of 5x5x5. So whenever you want to work out the number of cubes inside the "outer layer" of cubes, then you just reduce the dimension of each side by 2, and then multiply it out. As a result, looking at the cube in the picture, if you remove all the cubes on the outer layer then you're only left with 1 cube, since (3-2)*(3-2)*(3-2)=1.
If you need me to explain anything else then just tell me because my explanations are sometimes badly worded and can be a bit confusing.