Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

1.4 KiB
Raw Blame History

id, title, challengeType, videoUrl, dashedName
id title challengeType videoUrl dashedName
5900f5451000cf542c510057 问题472舒适的距离II 5 problem-472-comfortable-distance-ii

--description--

连续N个座位。 N人按照以下规则一个接一个地来到座位没有人坐在另一个人旁边。第一个人选择任何座位。只要不违反规则1每个后续人员选择离已经就座的人最远的座位。如果满足该条件的选择不止一个则该人选择最左边的选择。请注意由于规则1某些座位肯定会未被占用并且可以坐着的最大人数小于N对于N> 1

以下是N = 15的可能座位安排

我们看到如果第一个人选择正确15个座位最多可容纳7人。我们还可以看到第一个人有9个选择来最大化可能坐着的人数。

设fN是第一个人必须选择的数量以最大化连续N个座位的占用者数量。因此f1= 1f15= 9f20= 6并且f500= 16。

此外对于1≤N≤20ΣfN= 83对于1≤N≤500ΣfN= 13343。

找到ΣfN为1≤N≤1012。给出答案的最后8位数字。

--hints--

euler472()应该返回73811586。

assert.strictEqual(euler472(), 73811586);

--seed--

--seed-contents--

function euler472() {

  return true;
}

euler472();

--solutions--

// solution required