DWITE Online Computer Programming Contest
November 2008
Problem 3
My drink is made of cubes

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 it in the title.)

The input file DATA3.txt will contain 5 lines, integers 1 <= N <= 65000 -- the target volume of the package.

The output file OUT3.txt will contain 5 lines, the surface area of the optimal box that fits the specifications.

Example calculation: for a volume of 27, the optimal box is a 3*3*3 cube, so the surface area will be 6 sides * (3*3) = 54.

Again: If the volume is 15, then the optimal box is 5*3*1, so the surface area will be 46.

Final note: Make sure your program runs fast, even for large volumes.

Sample Input:
27
15
1
1000
64000
		        
Sample Output:
54
46
6
600
9600