2018-10-10 22:03:03 +00:00
|
|
|
---
|
|
|
|
id: 5900f4e01000cf542c50fff2
|
2021-02-06 04:42:36 +00:00
|
|
|
title: 'Problem 371: Licence plates'
|
2018-10-10 22:03:03 +00:00
|
|
|
challengeType: 5
|
2021-02-06 04:42:36 +00:00
|
|
|
forumTopicId: 302033
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: problem-371-licence-plates
|
2018-10-10 22:03:03 +00:00
|
|
|
---
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
# --description--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
Oregon licence plates consist of three letters followed by a three digit number (each digit can be from \[0..9]).
|
2018-10-10 22:03:03 +00:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
While driving to work Seth plays the following game:
|
2018-10-10 22:03:03 +00:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
Whenever the numbers of two licence plates seen on his trip add to 1000 that's a win.
|
2018-10-10 22:03:03 +00:00
|
|
|
|
2021-02-06 04:42:36 +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).
|
|
|
|
|
|
|
|
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.
|
2018-10-10 22:03:03 +00:00
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
# --hints--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
`euler371()` should return 40.66368097.
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
```js
|
2020-12-16 07:37:30 +00:00
|
|
|
assert.strictEqual(euler371(), 40.66368097);
|
2018-10-10 22:03:03 +00:00
|
|
|
```
|
|
|
|
|
2021-01-13 02:31:00 +00:00
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
|
|
|
function euler371() {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler371();
|
|
|
|
```
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
# --solutions--
|
2020-08-13 15:24:35 +00:00
|
|
|
|
2021-01-13 02:31:00 +00:00
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|