Jindra collects dice, all of the same size. Yesterday he found a box and started arranging the dice in it. He managed to fill the square bottom with one layer of dice. He then filled five more layers in the same way, but ran out of dice halfway through the next layer. Today, Jindra received 18 more dice from his grandmother, which were exactly what he needed to complete this layer.

How many dice did Jindra have yesterday?

(M. Petrová)

Hint. How many dice did Jindra have in each complete layer?
The 18 new cubes from grandma represented half of all the cubes in an incomplete (as well as in any other) layer. Thus, one layer contained 36 cubes $(2 \cdot 18=36)$. The layers are indeed square, consisting of 6 rows of 6 cubes each $(6 \cdot 6=36)$.

Yesterday, Jindra had six full layers and half of the seventh layer completed. In total, he had $234 \text{ cubes} (6 \cdot 36+18=234)$.

Notes. In the given solution, we verify that the determined number of cubes in a layer can form a square. Alternatively, we can start by testing possible dimensions of a square layer such that half of it represents 18 cubes. We quickly arrive at the same possibility of 6 rows of 6 cubes each.

Half of a layer can be rearranged into a rectangle, one side of which is half the length of the other. The number 18 can be factored in this way only as $18=3 \cdot 6$. Thus, one layer consisted of $6 \cdot 6=36$ cubes.