freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-411-uphill-paths.ch...

1.3 KiB
Raw Blame History

id challengeType title videoUrl localeTitle
5900f5081000cf542c510019 5 Problem 411: Uphill paths 问题411上坡路径

Description

设n是正整数。假设坐标xy=2i mod n3i mod n的站点为0≤i≤2n。我们将考虑与同一站点具有相同坐标的站点。

我们希望形成从0,0nn的路径使得x和y坐标永不减少。设Sn是路径可以通过的最大站数。

例如如果n = 22则有11个不同的站并且有效路径最多可以通过5个站。因此S22= 5.下面举例说明了一个最佳路径的例子:

还可以证实S123= 14并且S10000= 48。

求1Σk≤30ΣSk5

Instructions

Tests

tests:
  - text: <code>euler411()</code>应返回9936352。
    testString: 'assert.strictEqual(euler411(), 9936352, "<code>euler411()</code> should return 9936352.");'

Challenge Seed

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

euler411();

Solution

// solution required