fix(curriculum): clean-up Project Euler 221-240 (#42839)
* fix: clean-up Project Euler 221-240 * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@ -8,9 +8,15 @@ dashedName: problem-232-the-race
|
||||
|
||||
# --description--
|
||||
|
||||
Two players share an unbiased coin and take it in turns to play "The Race". On Player 1's turn, he tosses the coin once: if it comes up Heads, he scores one point; if it comes up Tails, he scores nothing. On Player 2's turn, she chooses a positive integer T and tosses the coin T times: if it comes up all Heads, she scores 2T-1 points; otherwise, she scores nothing. Player 1 goes first. The winner is the first to 100 or more points.
|
||||
Two players share an unbiased coin and take it in turns to play "The Race".
|
||||
|
||||
On each turn Player 2 selects the number, T, of coin tosses that maximises the probability of her winning.
|
||||
On Player 1's turn, he tosses the coin once: if it comes up Heads, he scores one point; if it comes up Tails, he scores nothing.
|
||||
|
||||
On Player 2's turn, she chooses a positive integer $T$ and tosses the coin $T$ times: if it comes up all Heads, she scores $2^{T - 1}$ points; otherwise, she scores nothing.
|
||||
|
||||
Player 1 goes first. The winner is the first to 100 or more points.
|
||||
|
||||
On each turn Player 2 selects the number, $T$, of coin tosses that maximises the probability of her winning.
|
||||
|
||||
What is the probability that Player 2 wins?
|
||||
|
||||
@ -18,10 +24,10 @@ Give your answer rounded to eight decimal places in the form 0.abcdefgh .
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler232()` should return 0.83648556.
|
||||
`theRace()` should return `0.83648556`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler232(), 0.83648556);
|
||||
assert.strictEqual(theRace(), 0.83648556);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +35,12 @@ assert.strictEqual(euler232(), 0.83648556);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler232() {
|
||||
function theRace() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler232();
|
||||
theRace();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user