freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-408-admissible-path...

1.3 KiB
Raw Blame History

id challengeType title videoUrl localeTitle
5900f5091000cf542c51001b 5 Problem 408: Admissible paths through a grid 问题408通过网格的可允许路径

Description

如果xy和x + y都是正的正方形那么我们称格子点xy是不允许的。例如9,16是不允许的0,43,19,4则不允许。

考虑从点x1y1到点x2y2的路径仅使用北或东的单位步长。如果其中间点都不允许我们可以称这样的路径是可以接受的。

令Pn是从0,0nn的可允许路径的数量。可以证实P5= 252P16= 596994440和P1000mod 1 000 000 007 = 341920854。

求P10 000 000mod 1 000 000 007。

Instructions

Tests

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

Challenge Seed

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

euler408();

Solution

// solution required