fix(curriculum): clean-up Project Euler 221-240 (#42839)
* fix: clean-up Project Euler 221-240 * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@@ -10,22 +10,39 @@ dashedName: problem-236-luxury-hampers
|
||||
|
||||
Suppliers 'A' and 'B' provided the following numbers of products for the luxury hamper market:
|
||||
|
||||
Product'A''B'Beluga Caviar5248640Christmas Cake13121888Gammon Joint26243776Vintage Port57603776Champagne Truffles39365664
|
||||
| Product | 'A' | 'B' |
|
||||
|--------------------|------|------|
|
||||
| Beluga Caviar | 5248 | 640 |
|
||||
| Christmas Cake | 1312 | 1888 |
|
||||
| Gammon Joint | 2624 | 3776 |
|
||||
| Vintage Port | 5760 | 3776 |
|
||||
| Champagne Truffles | 3936 | 5664 |
|
||||
|
||||
Although the suppliers try very hard to ship their goods in perfect condition, there is inevitably some spoilage - i.e. products gone bad.
|
||||
|
||||
The suppliers compare their performance using two types of statistic:The five per-product spoilage rates for each supplier are equal to the number of products gone bad divided by the number of products supplied, for each of the five products in turn. The overall spoilage rate for each supplier is equal to the total number of products gone bad divided by the total number of products provided by that supplier.To their surprise, the suppliers found that each of the five per-product spoilage rates was worse (higher) for 'B' than for 'A' by the same factor (ratio of spoilage rates), m>1; and yet, paradoxically, the overall spoilage rate was worse for 'A' than for 'B', also by a factor of m.
|
||||
The suppliers compare their performance using two types of statistic:
|
||||
|
||||
There are thirty-five m>1 for which this surprising result could have occurred, the smallest of which is 1476/1475.
|
||||
- The five per-product spoilage rates for each supplier are equal to the number of products gone bad divided by the number of products supplied, for each of the five products in turn.
|
||||
- The overall spoilage rate for each supplier is equal to the total number of products gone bad divided by the total number of products provided by that supplier.
|
||||
|
||||
What's the largest possible value of m? Give your answer as a fraction reduced to its lowest terms, in the form u/v.
|
||||
To their surprise, the suppliers found that each of the five per-product spoilage rates was worse (higher) for 'B' than for 'A' by the same factor (ratio of spoilage rates), $m > 1$; and yet, paradoxically, the overall spoilage rate was worse for 'A' than for 'B', also by a factor of $m$.
|
||||
|
||||
There are thirty-five $m > 1$ for which this surprising result could have occurred, the smallest of which is $\frac{1476}{1475}$.
|
||||
|
||||
What's the largest possible value of $m$? Give your answer as a string with fraction reduced to its lowest terms, in the form `u/v`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler236()` should return 123 / 59.
|
||||
`luxuryHampers()` should return a string.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler236(), 123 / 59);
|
||||
assert(typeof luxuryHampers() === 'string');
|
||||
```
|
||||
|
||||
`luxuryHampers()` should return the string `123/59`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(luxuryHampers(), '123/59');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -33,12 +50,12 @@ assert.strictEqual(euler236(), 123 / 59);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler236() {
|
||||
function luxuryHampers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler236();
|
||||
luxuryHampers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user