5. A four-digit number has the following property: dividing this four-digit number by its last two digits yields a perfect square (if the tens digit is zero, then divide by the units digit), and this perfect square is exactly the square of the first two digits minus 1. Then the number of four-digit numbers with the above property is ( ).
(A) 1
(B) 2
(C) 3
(D) 4
5.D.

Let the first two digits of this four-digit number be $c_{1}$, and the last two digits be $c_{2}$, then $10 \leqslant c_{1} \leqslant 99,1 \leqslant c_{2} \leqslant 99$. Thus, the original four-digit number can be represented as $100 c_{1}+c_{2}$. According to the problem, we have
$$
100 c_{1}+c_{2}=\left(c_{1}-1\right)^{2} c_{2}=c_{1}^{2} c_{2}-2 c_{1} c_{2}+c_{2} \text {, }
$$

which simplifies to $100 c_{1}=c_{1} c_{2}\left(c_{1}-2\right)$.
Solving for $c_{2}$, we get $c_{2}=\frac{100}{c_{1}-2}$.
Given $10 \leqslant c_{1} \leqslant 99$, $c_{1}$ can only take the values $12,22,27,52$. The corresponding $c_{2}$ values are $10,5,4,2$.
Therefore, the four-digit numbers we are looking for are
$$
1210,2205,2704,5202 .
$$