12.74 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$.
(19th International Mathematical Olympiad, 1977)
[Solution] From $r \geqslant 0$ and $q^{2}+r=1977$, we know
$$
q^{2} \leqslant 1977, q \leqslant \sqrt{1977}=44.4 \cdots .
$$

Thus, the possible pairs $(q, r)$ are
$$
(44,41),(43,128),(42,213), \cdots
$$

Since $a^{2}+b^{2}=(a+b) q+r, 0 \leqslant r < a+b$, we have
$$
q=\frac{a^{2}+b^{2}}{a+b}-\frac{r}{a+b}>\frac{1}{2} r-1,
$$
then when $q \leqslant 43$, $r \geqslant 128$, thus
$$
\frac{1}{2} r-1 \geqslant 63>43 \geqslant q.
$$

Therefore, it is impossible for $q \leqslant 43$.
Thus, $(q, r)$ can only be $(44,41)$.
Hence,
$$
\begin{array}{c}
a^{2}+b^{2}=44(a+b)+41, \\
(a-22)^{2}+(b-22)^{2}=1009 .
\end{array}
$$

Let $x=|a-22|, y=|b-22|$, then
$$
x^{2}+y^{2}=1009.
$$

Solving this, we get
$$
\left\{\begin{array}{l}
x=28, \\
y=15,
\end{array} \quad \left\{\begin{array}{l}
x=15 \\
y=28
\end{array}\right.\right.
$$

Thus, we have
$$
\left\{\begin{array}{l}
a_{1}=50, \\
b_{1}=37,
\end{array} \quad \left\{\begin{array}{l}
a_{2}=50, \\
b_{2}=7,
\end{array} \quad \left\{\begin{array}{l}
a_{3}=37, \\
b_{3}=50,
\end{array} \quad \left\{\begin{array}{l}
a_{4}=7, \\
b_{4}=50 .
\end{array}\right.\right.\right.\right.
$$

Therefore, the pairs $(a, b)$ are only four:
$$
(50,37),(50,7),(37,50),(7,50).
$$