Statistics

Problem Statement for "ShippingCubes"

Problem Statement

You want to ship N cubes abroad. The size of each cube is 1 x 1 x 1. You can only ship the cubes by filling them into a single cuboid box. The cost of shipping a cuboid box with dimensions a x b x c is equal to (a+b+c).

You can't leave any empty space in the box, because the cubes would shift and get damaged during the transfer.

You are given an int N. Return the minimal cost of shipping N cubes.

Definition

Class:
ShippingCubes
Method:
minimalCost
Parameters:
int
Returns:
int
Method signature:
int minimalCost(int N)
(be sure your method is public)

Constraints

  • N will be between 1 and 200, inclusive.

Examples

  1. 1

    Returns: 3

    The only way is to use a box with dimensions 1 x 1 x 1.

  2. 6

    Returns: 6

    This time one optimal solution is to send a box with dimensions 1 x 2 x 3. The cost of sending this box is 1+2+3 = 6. Any other option is at least as expensive as this one. For example, sending a box with dimensions 6 x 1 x 1 has the cost 6+1+1 = 8.

  3. 7

    Returns: 9

  4. 200

    Returns: 18

  5. 58

    Returns: 32

  6. 97

    Returns: 99

  7. 128

    Returns: 16

  8. 120

    Returns: 15

  9. 18

    Returns: 8

  10. 110

    Returns: 18

  11. 38

    Returns: 22

  12. 151

    Returns: 153

  13. 6

    Returns: 6

  14. 113

    Returns: 115

  15. 31

    Returns: 33

  16. 86

    Returns: 46

  17. 158

    Returns: 82

  18. 28

    Returns: 11

  19. 86

    Returns: 46

  20. 199

    Returns: 201

  21. 67

    Returns: 69

  22. 105

    Returns: 15

  23. 103

    Returns: 105

  24. 175

    Returns: 17

  25. 51

    Returns: 21

  26. 46

    Returns: 26

  27. 25

    Returns: 11

  28. 85

    Returns: 23

  29. 55

    Returns: 17

  30. 61

    Returns: 63

  31. 15

    Returns: 9

  32. 31

    Returns: 33

  33. 12

    Returns: 7

  34. 164

    Returns: 45

  35. 95

    Returns: 25

  36. 27

    Returns: 9

  37. 3

    Returns: 5

  38. 142

    Returns: 74

  39. 62

    Returns: 34

  40. 182

    Returns: 22

  41. 161

    Returns: 31

  42. 169

    Returns: 27

  43. 106

    Returns: 56

  44. 80

    Returns: 13

  45. 120

    Returns: 15

  46. 30

    Returns: 10

  47. 94

    Returns: 50

  48. 62

    Returns: 34

  49. 140

    Returns: 16

  50. 180

    Returns: 17

  51. 178

    Returns: 92

  52. 159

    Returns: 57

  53. 6

    Returns: 6

  54. 61

    Returns: 63

  55. 96

    Returns: 14

  56. 152

    Returns: 25

  57. 84

    Returns: 14

  58. 7

    Returns: 9

  59. 2

    Returns: 4

  60. 3

    Returns: 5

  61. 4

    Returns: 5

  62. 5

    Returns: 7

  63. 7

    Returns: 9

  64. 8

    Returns: 6

  65. 13

    Returns: 15

  66. 56

    Returns: 13

  67. 9

    Returns: 7

  68. 173

    Returns: 175

  69. 157

    Returns: 159

  70. 26

    Returns: 16

  71. 33

    Returns: 15

  72. 24

    Returns: 9

  73. 42

    Returns: 12

  74. 198

    Returns: 20

  75. 125

    Returns: 15

  76. 17

    Returns: 19

  77. 64

    Returns: 12

  78. 131

    Returns: 133


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)2024, TopCoder, Inc. All rights reserved.
This problem was used for: