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)
- (be sure your method is public)
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
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.19
1
2
Returns: 27
Ciel's cubes can be packed into 3x3x3 box. Its volume is 27.51
7
5
Returns: 950
12345
987
10
Returns: 999400