A certain company has recently introduced a whole line of "magic" boxes. The smallest of these boxes is a 1x1x1 hollow cube. The next size up is a 2x2x2 hollow cube, and so on, each box 1 unit bigger than the previous in all dimensions. However, because the boxes are so fragile, they can be packed neither inside of each other, nor on top of each other
You are to determine how large a set can fit in a certain sized crate. You are told that there is no restriction on the height of the crate, and the boxes may be packed tightly, with no space between them. Your task is, given x and y, representing the dimensions of the floor of the crate, determine the maximum number of boxes that can be safely packed, given that the sizes of the boxes start at 1x1x1 and increase by 1 with each box (no skipping boxes, if you ship a 3x3x3 box, you must also ship a 2x2x2 and a 1x1x1 box).
For example, a 3x5 crate could hold a 3x3x3, a 2x2x2 and a 1x1x1 box with this configuration (as viewed from above):
______ ____
| | |
| | 2 |
| 3 |____|
| | 1|
|______|__|
|