mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-14 07:00:51 -04:00
1.4 KiB
1.4 KiB
id, title, challengeType, forumTopicId, dashedName
| id | title | challengeType | forumTopicId | dashedName |
|---|---|---|---|---|
| 5900f3ea1000cf542c50fefd | Problem 126: Cuboid layers | 1 | 301753 | problem-126-cuboid-layers |
--description--
The minimum number of cubes to cover every visible face on a cuboid measuring 3 x 2 x 1 is twenty-two.
如果我们再添加第二层来覆盖现在这个体的每一个可见面,则需要 64 个立方体,第三层需要 78 个立方体,第四层需要 118 个。
而覆盖尺寸为 5 x 1 x 1 的长方体第一层同样也需要 22 个小立方体;类似的覆盖尺寸为 5 x 3 x 1,7 x 2 x 1,和 11 x 1 x 1 的第一层都需要 46 个立方体。
我们定义 C(n) 为可以用 n 个小立方体覆盖其某一层表面的长方体的数目。 则 $C(22) = 2$,$C(46) = 4$,$C(78) = 5$,而 $C(118) = 8$。
可以发现 154 是满足 C(n) = 10 时 n 的最小值。
求满足 C(n) = 1000 时,n 的最小值。
--hints--
cuboidLayers() 应该返回 18522。
assert.strictEqual(cuboidLayers(), 18522);
--seed--
--seed-contents--
function cuboidLayers() {
return true;
}
cuboidLayers();
--solutions--
// solution required