In the picture, there is a structure made of identical cubes. It is a cube with several holes through which you can see through, and these holes have the same cross-section everywhere. We have submerged the entire structure in paint. How many cubes have at least one side painted?

(M. Krejčová)

![](https://cdn.mathpix.com/cropped/2024_04_17_bf297f7f854ac26a2877g-3.jpg?height=491&width=512&top_left_y=1688&top_left_x=772)

Idea. Find out how many cubes do not have any side painted.
We will divide the building with four horizontal cuts into five layers as shown in the following image. The middle layer consists of 16 cubes, and the others always consist of 24 cubes. The total number of cubes is $16+4 \cdot 24=112$. The cubes that do not have any colored sides are marked with a black dot in the image - there are 8 of them. The other cubes have at least one colored side, and there are therefore $112-8=104$ of them.
![](https://cdn.mathpix.com/cropped/2024_04_17_bf297f7f854ac26a2877g-4.jpg?height=1058&width=512&top_left_y=404&top_left_x=772)

Another idea. Count directly by layers.

Another solution. We work with the image mentioned above. In the bottom layer, all 24 cubes have at least one colored side. In the second layer, there are 8 cubes with one colored side and 12 with two colored sides. In the middle layer, all 16 cubes have two colored sides. The fourth layer is the same as the second, and the fifth is the same as the first. We have counted a total of cubes with at least one colored side as follows:

$$
2 \cdot 24+2 \cdot(8+12)+16=48+40+16=104 .
$$