3. (15 points). In a hat box, there are 21 hats and 18 caps. They were distributed on two shelves: the first should accommodate 20 items, and the second - 19. After the distribution, the percentage of hats on each shelf was calculated and the resulting numbers were added together. What should be the distribution of hats on the shelves to maximize the sum of the percentages?
Solution. Solution 1. Instead of the total percentage, we will calculate the total share of hats, which are obviously 100 times different and reach their maximum simultaneously. Each hat on a shelf of 20 items constitutes $1 / 20$ of the total number of items on that shelf, and on a shelf of 19 items, it constitutes $1 / 19$ of the total number of items. Therefore, if we swap hats from the shelf with more items for caps from the shelf with fewer items, the total percentage of hats on the shelves will increase. Thus, the maximum is achieved when all such swaps are made, that is, when the shelf with fewer items consists entirely of hats, and the shelf with more items has 2 hats and 18 caps.

## Solution 2.

|  | Total number of items | Hats | Share on each shelf |
| :--- | :--- | :--- | :--- |
| Shelf 1 | 20 items | $x$ | $x / 20$ |
| Shelf 2 | 19 items | $21-x$ | $(21-x) / 19$ |

Thus, the total share of hats on the two shelves is $\frac{x}{20}+\frac{21-x}{19}=-\frac{x}{20 \cdot 19}+\frac{21}{19}=-\frac{x}{380}+\frac{21}{19}$, which is a linear function with a negative slope. Therefore, this function reaches its maximum value at the left end of the interval [2; 20], that is, when $x=2$. Thus, the shelf with fewer items is filled with only hats, and the shelf with more items has 2 hats and 18 caps.

Answer: On the second shelf - 19 hats, on the first shelf - 2 hats and 18 caps.

| Criterion Content | Points |
| :--- | :---: |
| The correct answer is obtained with justification. | 15 |
| An arithmetic error is made in an otherwise correct solution. | 10 |
| The problem is solved by selecting values of variables that satisfy the condition of the problem. | 5 |
| Some steps of a possible solution are observed. | 2 |
| The solution does not meet any of the criteria listed above. | 0 |
| Maximum score | 15 |