5$\cdot$32. A class has a total of 30 students, and each student has the same number of friends within the class. At the end of the term, any two students' grades can be compared, with no ties. How many students at most can have better grades than the majority of their friends?
[Solution] A student who has better grades than most of their friends is called a "good student". Let there be $x$ good students in the class, and each student has exactly $k$ friends.

Consider the friend pairs in the class. Clearly, there are $15k$ friend pairs in the class. The top student in the class is the better one in all of his $k$ friend pairs. Each of the other good students is the better one in at least $\left[\frac{k}{2}\right]+1 \geqslant \frac{k+1}{2}$ friend pairs. Therefore, the $x$ good students are the better ones in at least $k+\frac{1}{2}(x-1)(k+1)$ friend pairs. Thus, we have
$$
\frac{1}{2}(x-1)(k+1)+k \leqslant 15k.
$$

Solving this, we get
$$
x \leqslant 28 \frac{k}{k+1}+1.
$$

On the other hand, the number of students who perform worse than the worst good student is at most $30-x$, so we also have
$$
\begin{array}{l}
\frac{k+1}{2} \leqslant 30-x, \\
k \leqslant 59-2x.
\end{array}
$$

Since the right side of (1) is an increasing function of $k$, combining (1) and (2) gives
$$
x \leqslant 28 \cdot \frac{59-2x}{60-2x}+1.
$$

Rearranging, we get
$$
x^2 - 59x + 856 \geqslant 0.
$$

Solving (3), we get
$$
x \leqslant \frac{59-\sqrt{57}}{2}, \quad x \geqslant \frac{59+\sqrt{57}}{2}.
$$

Given that $x \leqslant 30$ is an integer, we know $x \leqslant 25$, meaning there can be at most 25 good students in the class.

To show that the number of good students can reach 25, from (1) and (2), we see that $k=9$ is suitable for $x=25$. Rank the students in the class by their grades from best to worst as $1, 2, \cdots, 30$, and fill these numbers into a $6 \times 5$ grid as shown in the figure. Define that two students are friends if their numbers fall into one of the following three cases:
(1) They are in adjacent rows but different columns;
(2) They are in the same column, but one is in the last row;
(3) They are both in the top row. It is easy to see that each person has exactly 9 friends, and the first 25 are all good students. In summary, the class can have at most 25 good students.