PROBLEM STATEMENT
Fox Ciel has Ns cubes with edge length 1 and Nb cubes with edge length L. She wants to pack her
cubes in a rectangular parallelepiped box. Each cube must be packed in the box such that each of
its edges is parallel to an edge of the box.
Ciel wants to know the smallest possible box she can use. Return the minimum possible volume of a
box which can store her cubes.
DEFINITION
Class:CubePacking
Method:getMinimumVolume
Parameters:int, int, int
Returns:int
Method signature:int getMinimumVolume(int Ns, int Nb, int L)
NOTES
-A rectangular parallelepiped is a closed box composed of three pairs of rectangular faces placed
opposite each other and joined at right angles to each other.
-The answer will fit in 32-bit signed integer.
CONSTRAINTS
-Ns will be between 1 and 1,000,000,000, inclusive.
-Nb will be between 1 and 1,000,000, inclusive.
-L will be between 2 and 10, inclusive.
EXAMPLES
0)
2
2
2
Returns: 20
Ciel has two 1x1x1 cubes and two 2x2x2 cubes. She can pack them into 2x2x5 box. The volume of this
box is 20.
1)
19
1
2
Returns: 27
Ciel's cubes can be packed into 3x3x3 box. Its volume is 27.
2)
51
7
5
Returns: 950
3)
12345
987
10
Returns: 999400
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.