5. Let the three-digit number $n=abc$, if $a, b, c$ can form an isosceles (including equilateral) triangle, then the number of such three-digit numbers $n$ is
(A) 45
(B) 81
(C) 165
(D) 216
(C)
5.【Analysis and Solution】For $a, b, c$ to form the sides of a triangle, they must all be non-zero. Thus, $a, b, c \in\{1,2, \ldots, 9\}$
(1) If they form an equilateral triangle, let the number of such three-digit numbers be $n_{1}$. Since all three digits in the number are the same, $n_{1}=\mathrm{C}_{9}^{1}=9$.
(2) If they form an isosceles (non-equilateral) triangle, let the number of such three-digit numbers be $n_{2}$. Since the three-digit number has only 2 different digits, let these be $a$ and $b$. Note that the positions of the two equal sides and the base can be swapped, so the number of digit pairs $(a, b)$ is $2 \mathrm{C}_{9}^{2}$. However, when the larger number is the base, if $a>b$, it must satisfy $b<a<2b$. In this case, the digit pairs that cannot form a triangle are:
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
\hline$a$ & 9 & 8 & 7 & 6 & 5 & 4 & 3 & 2 & 1 \\
\hline$b$ & 4,3 & 4,3 & 3,2 & 3,2 & 1,2 & 1,2 & 1 & 1 & \\
\hline
\end{tabular}

There are 20 such cases.
At the same time, for each digit pair $(a, b)$, the two digits can be placed in two of the three positions, which gives $\mathrm{C}_{3}^{2}$ possibilities. Therefore, $n_{2}=\mathrm{C}_{3}^{2}\left(2 \mathrm{C}_{9}^{2}-20\right)=6\left(\mathrm{C}_{9}^{2}-10\right)=156$. In summary, $n=n_{1}+n_{2}=165$.