N19 (19-5, German Democratic Republic) Let $a, b$ be positive integers. When $a^{2}+b^{2}$ is divided by $a+b$, the quotient is $q$, and the remainder is $r$. Find all pairs $(a, b)$ such that $q^{2}+r=1977$.

When $a^{2}+b^{2}$ is divided by $a+b$, the quotient is $q$, and the remainder is $r$, find all pairs $(a, b)$ such that $q^{2}+r=1977$.
Solve: From the given conditions,
$$
\begin{array}{c}
a^{2}+b^{2}=q(a+b)+r, \\
q^{2}+r=1977 .
\end{array}
$$

From (2), we get $q^{2} \leqslant 1977$, thus $q \leqslant 44$.
If $q \leqslant 43$, from (2) we get
$$
r=1977-q^{2} \geqslant 1977-43^{2}=128 .
$$

Also, by $r \geqslant 128$ we get a contradiction.
Therefore, we can only have $q=44, r=41$. Thus,
$$
\begin{array}{c}
a^{2}+b^{2}=44(a+b)+41, \\
(a-22)^{2}+(b-22)^{2}=1009 .
\end{array}
$$

Assume $|a-22| \geqslant|b-22|$, then
$$
\begin{array}{c}
\frac{1009}{2} \leqslant(a-22)^{2} \leqslant 1009, \\
45 \leqslant a \leqslant 53,
\end{array}
$$

By verification, we get two sets of solutions $(a, b)=(50,7),(50,37)$.
Therefore, the required pairs $(a, b)=(50,7),(50,37),(7,50),(37,50)$.