2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: 5900f5181000cf542c51002a
|
|
|
|
|
challengeType: 5
|
|
|
|
|
title: 'Problem 427: n-sequences'
|
|
|
|
|
videoUrl: ''
|
2020-02-18 01:40:55 +09:00
|
|
|
|
localeTitle: 问题427:n序列
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-02-18 01:40:55 +09:00
|
|
|
|
<section id="description">
|
|
|
|
|
整数序列S = {si}如果具有n个元素,则每个元素满足1≤si≤n,则称为n序列。 因此,总共有nn个不同的n序列。
|
|
|
|
|
例如,序列S = {1、5、5、10、7、7、7、2、3、7}是10个序列。
|
|
|
|
|
|
|
|
|
|
对于任何序列S,令L(S)为具有相同值的S的最长连续存在的长度。
|
|
|
|
|
例如,对于上面给定的序列S,由于三个连续的7,L(S)= 3。
|
|
|
|
|
|
|
|
|
|
对于所有n序列S,令f(n)= ∑ L(S)。
|
|
|
|
|
|
|
|
|
|
例如,f(3)= 45,f(7)= 1403689和f(11)= 481496895121。
|
|
|
|
|
|
|
|
|
|
找出f(7,500,000)mod 1 000 009。
|
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
## Instructions
|
2020-02-18 01:40:55 +09:00
|
|
|
|
<section id="instructions">
|
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
2020-02-18 01:40:55 +09:00
|
|
|
|
- text: <code>euler427()</code>应该返回97138867。
|
|
|
|
|
testString: assert.strictEqual(euler427(), 97138867);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function euler427() {
|
|
|
|
|
// Good luck!
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
euler427();
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
|
|
|
|
</section>
|