freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-398-cutting-rope.md

1.1 KiB
Raw Blame History

id challengeType videoUrl localeTitle
5900f4fa1000cf542c51000d 5 问题398切割绳索

Description

在长度为n的绳索内放置n-1个点彼此之间的距离为1并且从端点开始。在这些点中我们随机选择m-1个点并在这些点处切断绳索以创建m个段。

设Enm为第二最短段的预期长度。例如E3,2= 2且E8,3= 16/7。注意如果多个段具有相同的最短长度则将第二最短段的长度定义为与最短长度相同。

找到E107,100。将您的答案四舍五入到小数点后面的小数点后5位。

Instructions

Tests

tests:
  - text: <code>euler398()</code>应返回2010.59096。
    testString: assert.strictEqual(euler398(), 2010.59096);

Challenge Seed

function euler398() {
  // Good luck!
  return true;
}

euler398();

Solution

// solution required

/section>