fix(curriculum): clean-up Project Euler 241-260 (#42879)
* fix: clean-up Project Euler 241-260 * fix: typo * Update curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-255-rounded-square-roots.md Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@ -10,24 +10,34 @@ dashedName: problem-260-stone-game
|
||||
|
||||
A game is played with three piles of stones and two players.
|
||||
|
||||
At her turn, a player removes one or more stones from the piles. However, if she takes stones from more than one pile, she must remove the same number of stones from each of the selected piles.
|
||||
On each player's turn, the player removes one or more stones from the piles. However, if the player takes stones from more than one pile, the same number of stunes must be removed from each of the selected piles.
|
||||
|
||||
In other words, the player chooses some N>0 and removes: N stones from any single pile; or N stones from each of any two piles (2N total); or N stones from each of the three piles (3N total). The player taking the last stone(s) wins the game.
|
||||
In other words, the player chooses some $N > 0$ and removes:
|
||||
|
||||
A winning configuration is one where the first player can force a win. For example, (0,0,13), (0,11,11) and (5,5,5) are winning configurations because the first player can immediately remove all stones.
|
||||
- $N$ stones from any single pile; or
|
||||
- $N$ stones from each of any two piles ($2N$ total); or
|
||||
- $N$ stones from each of the three piles ($3N$ total).
|
||||
|
||||
A losing configuration is one where the second player can force a win, no matter what the first player does. For example, (0,1,2) and (1,3,3) are losing configurations: any legal move leaves a winning configuration for the second player.
|
||||
The player taking the last stone(s) wins the game.
|
||||
|
||||
Consider all losing configurations (xi,yi,zi) where xi ≤ yi ≤ zi ≤ 100. We can verify that Σ(xi+yi+zi) = 173895 for these.
|
||||
A winning configuration is one where the first player can force a win.
|
||||
|
||||
Find Σ(xi+yi+zi) where (xi,yi,zi) ranges over the losing configurations with xi ≤ yi ≤ zi ≤ 1000.
|
||||
For example, (0,0,13), (0,11,11) and (5,5,5) are winning configurations because the first player can immediately remove all stones.
|
||||
|
||||
A losing configuration is one where the second player can force a win, no matter what the first player does.
|
||||
|
||||
For example, (0,1,2) and (1,3,3) are losing configurations: any legal move leaves a winning configuration for the second player.
|
||||
|
||||
Consider all losing configurations ($x_i$,$y_i$,$z_i$) where $x_i ≤ y_i ≤ z_i ≤ 100$. We can verify that $\sum (x_i + y_i + z_i) = 173\\,895$ for these.
|
||||
|
||||
Find $\sum (x_i + y_i + z_i)$ where ($x_i$,$y_i$,$z_i$) ranges over the losing configurations with $x_i ≤ y_i ≤ z_i ≤ 1000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler260()` should return 167542057.
|
||||
`stoneGame()` should return `167542057`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler260(), 167542057);
|
||||
assert.strictEqual(stoneGame(), 167542057);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +45,12 @@ assert.strictEqual(euler260(), 167542057);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler260() {
|
||||
function stoneGame() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler260();
|
||||
stoneGame();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user