freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-472-comfortable-dis...

56 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f5451000cf542c510057
challengeType: 5
title: 'Problem 472: Comfortable Distance II'
videoUrl: ''
localeTitle: 问题472舒适的距离II
---
## Description
<section id="description">连续N个座位。 N人按照以下规则一个接一个地来到座位没有人坐在另一个人旁边。第一个人选择任何座位。只要不违反规则1每个后续人员选择离已经就座的人最远的座位。如果满足该条件的选择不止一个则该人选择最左边的选择。请注意由于规则1某些座位肯定会未被占用并且可以坐着的最大人数小于N对于N&gt; 1<p>以下是N = 15的可能座位安排 </p><p>我们看到如果第一个人选择正确15个座位最多可容纳7人。我们还可以看到第一个人有9个选择来最大化可能坐着的人数。 </p><p>设fN是第一个人必须选择的数量以最大化连续N个座位的占用者数量。因此f1= 1f15= 9f20= 6并且f500= 16。 </p><p>此外对于1≤N≤20ΣfN= 83对于1≤N≤500ΣfN= 13343。 </p><p>找到ΣfN为1≤N≤1012。给出答案的最后8位数字。 </p></section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler472()</code>应该返回73811586。
testString: 'assert.strictEqual(euler472(), 73811586, "<code>euler472()</code> should return 73811586.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler472() {
// Good luck!
return true;
}
euler472();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>