4. Let the three-digit number $\bar{b} c$ be divisible by 3, and let $a$, $b$, and $c$ be the lengths of the sides of an isosceles triangle (including equilateral triangles). Then the number of such three-digit numbers is ( ) .
(A) 21
(B) 36
(C) 45
(D) 63
4.C.

From the problem, we know that $a+b+c$ is a multiple of 3, and $a, b, c$ are positive integers from 1 to 9.
When $a=b=c$, there are 9 three-digit numbers that satisfy the condition;
When two of $a, b, c$ are equal, let's assume $a=b$, then there are $441, 447, 552, 558, 663, 669, 771, 774, 882, 885, 993$, 996, a total of 12 numbers that satisfy the condition. Therefore, when $b=c$ or $a=c$, there are also 12 numbers that satisfy the condition each.
Thus, the total number of three-digit numbers that satisfy the condition is $9 + 12 \times 3 = 45$.