DWITE Online Computer Programming Contest, November 2008, Problem 3
In order to save on production cost, a company wants to find an optimal design for their new line of drink products. Given the volume of the contents, what is the minimum amount of material (surface area) needed to make a box? (This company is very cheap, and will sell their drinks in boxes).
An odd requirement is that the inside volume must be exact, and each side must be an integer value in length. (Note: that means that in some cases a box will use more material than a different box that could have held more volume.) (Also: it might help to think of contents as unit cubes, not liquid... but I already wrote the title).
The input will contain 5 lines, integers – target volume of the package.
The output will contain 5 lines, the surface area of the optimal box that fits the specifications.
Example calculation: for a volume of , the optimal box is a cube; so the surface area will be .
Again: if the volume is , then the optimal box is ; so the surface area will be .
Final note: make sure your program runs fast, even for large volumes.
27 15 1 1000 64000
54 46 6 600 9600