fix(curriculum): clean-up Project Euler 321-340 (#42988)

* fix: clean-up Project Euler 321-340

* fix: typo

* fix: corrections from review

Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com>

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com>
Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-29 20:59:06 +02:00
committed by GitHub
parent a9c11f7fe2
commit 1af6e7aa5a
20 changed files with 264 additions and 186 deletions

View File

@ -10,7 +10,9 @@ dashedName: problem-327-rooms-of-doom
A series of three rooms are connected to each other by automatic doors.
Each door is operated by a security card. Once you enter a room the door automatically closes and that security card cannot be used again. A machine at the start will dispense an unlimited number of cards, but each room (including the starting room) contains scanners and if they detect that you are holding more than three security cards or if they detect an unattended security card on the floor, then all the doors will become permanently locked. However, each room contains a box where you may safely store any number of security cards for use at a later stage.
<img class="img-responsive center-block" alt="series of three rooms, connected to each other by automatic doors" src="https://cdn.freecodecamp.org/curriculum/project-euler/rooms-of-doom.gif" style="background-color: white; padding: 10px;">
Each door is operated by a security card. Once you enter a room, the door automatically closes, and that security card cannot be used again. A machine will dispense an unlimited number of cards at the start, but each room (including the starting room) contains scanners. If they detect that you are holding more than three security cards or if they detect an unattended security card on the floor, then all the doors will become permanently locked. However, each room contains a box where you may safely store any number of security cards for use at a later stage.
If you simply tried to travel through the rooms one at a time then as you entered room 3 you would have used all three cards and would be trapped in that room forever!
@ -18,20 +20,26 @@ However, if you make use of the storage boxes, then escape is possible. For exam
It is possible to travel through six rooms using a total of 123 security cards while carrying a maximum of 3 cards.
Let C be the maximum number of cards which can be carried at any time. Let R be the number of rooms to travel through. Let M(C,R) be the minimum number of cards required from the dispensing machine to travel through R rooms carrying up to a maximum of C cards at any time.
Let $C$ be the maximum number of cards which can be carried at any time.
For example, M(3,6)=123 and M(4,6)=23.And, ΣM(C,6)=146 for 3 ≤ C ≤ 4.
Let $R$ be the number of rooms to travel through.
You are given that ΣM(C,10)=10382 for 3 ≤ C ≤ 10.
Let $M(C, R)$ be the minimum number of cards required from the dispensing machine to travel through $R$ rooms carrying up to a maximum of $C$ cards at any time.
Find ΣM(C,30) for 3 ≤ C ≤ 40.
For example, $M(3, 6) = 123$ and $M(4, 6) = 23$.
And, $\sum M(C, 6) = 146$ for $3 ≤ C ≤ 4$.
You are given that $\sum M(C, 10) = 10382$ for $3 ≤ C ≤ 10$.
Find $\sum M(C, 30)$ for $3 ≤ C ≤ 40$.
# --hints--
`euler327()` should return 34315549139516.
`roomsOfDoom()` should return `34315549139516`.
```js
assert.strictEqual(euler327(), 34315549139516);
assert.strictEqual(roomsOfDoom(), 34315549139516);
```
# --seed--
@ -39,12 +47,12 @@ assert.strictEqual(euler327(), 34315549139516);
## --seed-contents--
```js
function euler327() {
function roomsOfDoom() {
return true;
}
euler327();
roomsOfDoom();
```
# --solutions--