2. In front of Vasya lies a stack of 15 red, 15 blue, and 15 yellow cards. Vasya needs to choose 15 out of all 45 cards to earn the maximum number of points. Points are awarded as follows: for each red card, Vasya gets one point. For each blue card, Vasya gets a number of points equal to twice the number of selected red cards, and for each yellow card, Vasya gets a number of points equal to three times the number of selected blue cards. What is the maximum number of points Vasya can earn?
Answer: 168.

Let the number of red, blue, and yellow cards taken by Vasya be denoted by $\mathrm{K}$, C, and Y, respectively. The number of points Vasya will receive is given by the formula

$$
\mathrm{K}+2 \cdot \mathrm{K} \cdot \mathrm{C}+3 \cdot \mathrm{C} \cdot \mathrm{K}=\mathrm{K} \cdot(2 \mathrm{C}+1)+\mathrm{K} \cdot 3 \mathrm{C}
$$

If $\mathrm{C}=0$, then Vasya will receive points only for the red cards, which means no more than 15 points.

If $\mathrm{C} \geqslant 1$, then $2 \mathrm{C}+1 \leqslant 3 \mathrm{C}$, and as can be seen from the formula above, replacing all red cards with yellow cards will not decrease the number of points Vasya scores. Therefore, we can assume that Vasya took only yellow and blue cards, and then $\mathrm{C}+\mathcal{K}=15$. The total number of points scored is calculated by the formula

$$
3 \cdot \mathrm{C} \cdot(15-\mathrm{C}) \text {. }
$$

Consider the parabola $f(x)=3 x(15-x)$. The maximum value at an integer point is achieved when this point is closest to the vertex of the parabola, i.e., at $x=7$ or $x=8$. The number of points in this case is $3 \cdot 7 \cdot 8=168$.

## Criteria

+ Correct solution - 7 points.

$\pm$ The solution is reduced to finding the maximum of the function $3 x(15-x)-5$ points.

Ғ It is proven that (in the case of the maximum number of points) all red cards can be replaced by yellow cards - 3 points.

-. Correct answer without justification of maximality (or with incorrect justification) - 1 point.

- Correct answer without justification (or with incorrect justification) - 0 points.