2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f4e01000cf542c50fff2
|
|
|
|
challengeType: 5
|
|
|
|
title: 'Problem 371: Licence plates'
|
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
|
|
Oregon licence plates consist of three letters followed by a three digit number (each digit can be from [0..9]).
|
|
|
|
While driving to work Seth plays the following game:
|
|
|
|
Whenever the numbers of two licence plates seen on his trip add to 1000 that's a win.
|
|
|
|
|
|
|
|
|
2018-10-08 00:01:53 +00:00
|
|
|
E.g. MIC-012 and HAN-988 is a win and RYU-500 and SET-500 too. (as long as he sees them in the same trip).
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
Find the expected number of plates he needs to see for a win.
|
|
|
|
Give your answer rounded to 8 decimal places behind the decimal point.
|
|
|
|
|
|
|
|
|
|
|
|
Note: We assume that each licence plate seen is equally likely to have any three digit number on it.
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id='instructions'>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
2018-10-04 13:37:37 +00:00
|
|
|
tests:
|
|
|
|
- text: <code>euler371()</code> should return 40.66368097.
|
2018-10-08 00:01:53 +00:00
|
|
|
testString: 'assert.strictEqual(euler371(), 40.66368097, "<code>euler371()</code> should return 40.66368097.");'
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
function euler371() {
|
|
|
|
// Good luck!
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler371();
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|
|
|
|
</section>
|