chore(i8n,learn): processed translations
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
15047f2d90
commit
e5c44a3ae5
@ -1,28 +1,33 @@
|
||||
---
|
||||
id: 5900f4991000cf542c50ffab
|
||||
title: 问题301:尼姆
|
||||
title: 'Problem 301: Nim'
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
forumTopicId: 301955
|
||||
dashedName: problem-301-nim
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
尼姆(Nim)是一堆用石头堆砌而成的游戏,两名玩家轮流用它来清除任何堆石,直到没有石头为止。
|
||||
Nim is a game played with heaps of stones, where two players take it in turn to remove any number of stones from any heap until no stones remain.
|
||||
|
||||
我们将考虑Nim的三堆普通播放版本,其工作方式如下:
|
||||
We'll consider the three-heap normal-play version of Nim, which works as follows:
|
||||
|
||||
\-游戏开始时有三堆石头。 -玩家在回合时从任何一个堆中移出正数的石头。 -第一个无法移动(因为没有剩余的石头)的玩家输了。
|
||||
- At the start of the game there are three heaps of stones.
|
||||
- On his turn the player removes any positive number of stones from any single heap.
|
||||
- The first player unable to move (because no stones remain) loses.
|
||||
|
||||
如果(n1,n2,n3)表示由大小为n1,n2和n3的堆组成的Nim位置,则存在一个简单函数X(n1,n2,n3)-您可以查找或尝试自己推断-返回值:如果采用完美策略,将要移动的玩家最终会输掉,则返回零;或非零,如果采用完美策略,将要移动的玩家最终会获胜。例如X(1,2,3)= 0,因为无论当前玩家做什么,他的对手都可以通过移动而留下两个相同大小的堆,而此时,当前玩家的每一步都可以被镜像他的对手,直到没有剩下的石头;因此当前玩家输了。为了显示:
|
||||
If (n1,n2,n3) indicates a Nim position consisting of heaps of size n1, n2 and n3 then there is a simple function X(n1,n2,n3) — that you may look up or attempt to deduce for yourself — that returns: zero if, with perfect strategy, the player about to move will eventually lose; or non-zero if, with perfect strategy, the player about to move will eventually win. For example X(1,2,3) = 0 because, no matter what the current player does, his opponent can respond with a move that leaves two heaps of equal size, at which point every move by the current player can be mirrored by his opponent until no stones remain; so the current player loses. To illustrate:
|
||||
|
||||
\-当前玩家移至(1,2,1) -对手移动至(1,0,1) -当前玩家移至(0,0,1) -对手移动到(0,0,0),因此获胜。
|
||||
- current player moves to (1,2,1)
|
||||
- opponent moves to (1,0,1)
|
||||
- current player moves to (0,0,1)
|
||||
- opponent moves to (0,0,0), and so wins.
|
||||
|
||||
对于多少个正整数n≤230,X(n,2n,3n)= 0?
|
||||
For how many positive integers n ≤ 230 does X(n,2n,3n) = 0 ?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler301()`应该返回2178309。
|
||||
`euler301()` should return 2178309.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler301(), 2178309);
|
||||
|
Reference in New Issue
Block a user