We know that both Danka and Janka painted three sides of the cube. This can only be done in two ways:

1. Two opposite sides are painted, and then one side between them is also painted; consider, for example, the top, bottom, and one side.
2. No two opposite sides are painted, so the three painted sides share a common vertex; consider, for example, the top, front, and side.

If the number of painted small cubes in each case is different, the girls must have painted the cubes in different ways. For each way of painting, we will determine how many small cubes have at least one side painted. We will proceed layer by layer, counting layers from the bottom:

1. In the first and fifth layers, all 25 small cubes have at least one side painted, in the second, third, and fourth layers, 5 small cubes are painted each time; in total, in this case, $25+5+5+5+25=65$ small cubes are painted.
2. In the first four layers, 9 small cubes have at least one side painted each time, in the fifth layer, all 25 small cubes are painted; in total, in this case, $9+9+9+9+25=61$ small cubes are painted.

The sought difference in the number of painted small cubes is $65-61=4$.

Evaluation. 1 point for determining the possible ways of painting; 4 points for determining the number of painted small cubes in each case; 1 point for the difference.

Note. The difference can also be determined without calculating the total number of painted small cubes in each case. In such a solution, evaluate the second part of the task with 1 to 5 points based on the quality of the justification (the first point is the same).
Danka and Janka received two identical white cubes for their birthdays, each made up of 125 small cubes as shown in the picture. To distinguish the cubes, they decided to paint them. Danka took a brush and painted three of the six faces of her cube red. Janka painted three faces of her cube green. After some time, both cubes were cut into the individual small cubes they were made of. When they did this, they were surprised to find that the number of small cubes with at least one red face differed from the number of small cubes with at least one green face. Determine this difference.

(E. Novotná)

![](https://cdn.mathpix.com/cropped/2024_04_17_1af6648ff2d5da4e2253g-1.jpg?height=426&width=434&top_left_y=838&top_left_x=820)