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.5 KiB
Raw Blame History

id, title, challengeType, videoUrl, dashedName
id title challengeType videoUrl dashedName
5900f4991000cf542c50ffab 问题301尼姆 5 problem-301-nim

--description--

尼姆Nim是一堆用石头堆砌而成的游戏两名玩家轮流用它来清除任何堆石直到没有石头为止。

我们将考虑Nim的三堆普通播放版本其工作方式如下

-游戏开始时有三堆石头。 -玩家在回合时从任何一个堆中移出正数的石头。 -第一个无法移动(因为没有剩余的石头)的玩家输了。

如果n1n2n3表示由大小为n1n2和n3的堆组成的Nim位置则存在一个简单函数Xn1n2n3-您可​​以查找或尝试自己推断-返回值如果采用完美策略将要移动的玩家最终会输掉则返回零或非零如果采用完美策略将要移动的玩家最终会获胜。例如X1,2,3= 0因为无论当前玩家做什么他的对手都可以通过移动而留下两个相同大小的堆而此时当前玩家的每一步都可以被镜像他的对手直到没有剩下的石头因此当前玩家输了。为了显示

-当前玩家移至1,2,1 -对手移动至1,0,1 -当前玩家移至0,0,1 -对手移动到0,0,0因此获胜。

对于多少个正整数n≤230Xn2n3n= 0

--hints--

euler301()应该返回2178309。

assert.strictEqual(euler301(), 2178309);

--seed--

--seed-contents--

function euler301() {

  return true;
}

euler301();

--solutions--

// solution required