B1. The set $S$ contains 6 distinct positive integers. The average of the two smallest numbers is 5 and the average of the two largest is 22 . What is the greatest possible average of all the numbers in the set $S$ ?
Solution: Let $S=\left\{s_{1}, \ldots, s_{6}\right\}$, where $s_{1}<s_{2}<\cdots<s_{6}$. Then $s_{1}+s_{2}=10$ and $s_{5}+s_{6}=44$. Since $s_{5}$ and $s_{6}$ are distinct, we have $s_{5} \leq 21$. But then $s_{4} \leq s_{5}-1 \leq 20$ and $s_{3} \leq s_{4}-1 \leq 19$. Thus
$$
s_{1}+\cdots+s_{6}=10+s_{3}+s_{4}+44 \leq 10+19+20+44=93
$$

The greatest possible average is therefore $\frac{93}{6}=\frac{31}{2}=15.5$.
Note that this is indeed obtained with $S=\{4,6,19,20,21,23\}$.
Answer: 15.5