2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f4e01000cf542c50fff2
|
|
|
|
title: 'Problem 371: Licence plates'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 302033
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-371-licence-plates
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 21:48:17 +02:00
|
|
|
Oregon licence plates consist of three letters followed by a three digit number (each digit can be from [0...9]).
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
While driving to work Seth plays the following game:
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
Whenever the numbers of two licence plates seen on his trip add to 1000 that's a win.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2022-03-19 00:56:57 -07: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 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01: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.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 21:48:17 +02:00
|
|
|
**Note:** We assume that each licence plate seen is equally likely to have any three digit number on it.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --hints--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 21:48:17 +02:00
|
|
|
`licensePlates()` should return `40.66368097`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-29 21:48:17 +02:00
|
|
|
assert.strictEqual(licensePlates(), 40.66368097);
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --seed--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --seed-contents--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
2021-07-29 21:48:17 +02:00
|
|
|
function licensePlates() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-29 21:48:17 +02:00
|
|
|
licensePlates();
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --solutions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|