freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-149-searching-for-a...

74 lines
1.4 KiB
Markdown
Raw Normal View History

---
id: 5900f4021000cf542c50ff13
challengeType: 5
videoUrl: ''
localeTitle: 问题149搜索最大和子序列
---
## Description
<section id="description">
查看下表可以很容易地验证任意方向水平垂直对角或反对角上相邻数字的最大和为16= 8 + 7 + 1
253296513273184 8
现在,让我们重复搜索,但范围更大:
首先,使用称为“滞后斐波那契生成器”的特定形式生成四百万个伪随机数:
对于1≤k≤55sk = [100003 200003k + 300007k3]模1000000 500000。
对于56≤k≤4000000sk = [sk-24 + sk-55 + 1000000]模1000000 500000。
因此s10 = -393027s100 = 86613。
然后将s的项排列在2000×2000表中使用前2000个数字顺序填充第一行使用后2000个数字填充第二行依此类推。
最后,在任何方向(水平,垂直,对角线或反对角线)上找到(任意数量)相邻项的最大和。
</section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler149()</code>应该返回52852124。
testString: assert.strictEqual(euler149(), 52852124);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler149() {
// Good luck!
return true;
}
euler149();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
/section>