The set $S$ consists of 9 distinct positive integers. The average of the two smallest integers in $S$ is 5 . The average of the two largest integers in $S$ is 22 . What is the greatest possible average of all of the integers of $S$ ?
(A) 15
(B) 16
(C) 17
(D) 18
(E) 19
Since the average of the two smallest integers in $S$ is 5 , their sum is $2 \cdot 5=10$.

Since the average of the two largest integers in $S$ is 22 , their sum is $2 \cdot 22=44$.

Suppose that the other five integers in the set $S$ are $p<q<r<t<u$. (Note that the integers in $S$ are all distinct.)

The average of the nine integers in $S$ is thus equal to $\frac{10+44+p+q+r+t+u}{9}$ which equals $6+\frac{p+q+r+t+u}{9}$.

We would like this average to be as large as possible.

To make this average as large as possible, we want $\frac{p+q+r+t+u}{9}$ to be as large as possible, which means that we want $p+q+r+t+u$ to be as large as possible.

What is the maximum possible value of $u$ ?

Let $x$ and $y$ be the two largest integers in $S$, with $x<y$. Since $x$ and $y$ are the two largest integers, then $u<x<y$.

Since $x+y=44$ and $x<y$ and $x$ and $y$ are integers, then $x \leq 21$.

For $u$ to be as large as possible (which will allow us to make $p, q, r, t$ as large as possible), we set $x=21$.

In this case, we can have $u=20$.

To make $p, q, r, t$ as large as possible, we can take $p=16, q=17, r=18, t=19$.

Here, $p+q+r+t+u=90$.

If $x<21$, then $p+q+r+t+u$ will be smaller and so not give the maximum possible value.

This means that the maximum possible average of the integers in $S$ is $6+\frac{90}{9}=16$.

ANSWER: (B)