55 lines
1.9 KiB
Markdown
55 lines
1.9 KiB
Markdown
---
|
|
id: 5900f3e01000cf542c50fef3
|
|
title: 'Problem 116: Red, green or blue tiles'
|
|
challengeType: 5
|
|
forumTopicId: 301742
|
|
dashedName: problem-116-red-green-or-blue-tiles
|
|
---
|
|
|
|
# --description--
|
|
|
|
A row of five black square tiles is to have a number of its tiles replaced with coloured oblong tiles chosen from red (length two), green (length three), or blue (length four).
|
|
|
|
If red tiles are chosen there are exactly seven ways this can be done.
|
|
|
|
<img class="img-responsive center-block" alt="Possible ways to placing red oblong on a row with length of five units" src="https://cdn.freecodecamp.org/curriculum/project-euler/red-green-or-blue-tiles-1.png" style="background-color: white; padding: 10px;">
|
|
|
|
If green tiles are chosen there are three ways.
|
|
|
|
<img class="img-responsive center-block" alt="Possible ways of placing green oblong on a row with length of five units" src="https://cdn.freecodecamp.org/curriculum/project-euler/red-green-or-blue-tiles-2.png" style="background-color: white; padding: 10px;">
|
|
|
|
And if blue tiles are chosen there are two ways.
|
|
|
|
<img class="img-responsive center-block" alt="Possible ways of placing blue oblong on a row with length of five units" src="https://cdn.freecodecamp.org/curriculum/project-euler/red-green-or-blue-tiles-3.png" style="background-color: white; padding: 10px;">
|
|
|
|
Assuming that colors cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colors cannot be mixed and at least one colored tile must be used?
|
|
|
|
**Note:** This is related to Problem 117.
|
|
|
|
# --hints--
|
|
|
|
`redGreenBlueOne()` should return `20492570929`.
|
|
|
|
```js
|
|
assert.strictEqual(redGreenBlueOne(), 20492570929);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```js
|
|
function redGreenBlueOne() {
|
|
|
|
return true;
|
|
}
|
|
|
|
redGreenBlueOne();
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```js
|
|
// solution required
|
|
```
|