(4) If the surface areas of three cubes, each with integer edge lengths (unit: $\mathrm{cm}$), sum up to $564 \mathrm{~cm}^{2}$, then the sum of the volumes of these three cubes is ( ).
(A) $764 \mathrm{~cm}^{3}$ or $586 \mathrm{~cm}^{3}$
(B) $764 \mathrm{~cm}^{3}$
(C) $586 \mathrm{~cm}^{3}$ or $564 \mathrm{~cm}^{3}$
(D) $586 \mathrm{~cm}^{3}$
4. Let the edge lengths of the three cubes be \(a\), \(b\), and \(c\), then we have \(6\left(a^{2}+b^{2}+c^{2}\right)=564\), which simplifies to \(a^{2}+b^{2}+c^{2}=94\). Without loss of generality, assume
\[
1 \leqslant a \leqslant b \leqslant c \leqslant 31.
\end{array}
\]

Thus, \(6 \leqslant c < 10\), so \(c\) can only be \(9\), \(8\), \(7\), or \(6\).
If \(c=9\), then
\[
a^{2}+b^{2}=94-9^{2}=13,
\]
it is easy to see that \(a=2\), \(b=3\), giving one solution \((a, b, c)=(2,3,9)\).
If \(c=8\), then
\[
a^{2}+b^{2}=94-64=30, \quad b \leqslant 5.
\]
But \(2 b^{2} \geqslant 30\), which means \(b \geqslant 4\), so \(b=4\) or \(5\). If \(b=5\), then \(a^{2}=5\) has no solution; if \(b=4\), then \(a^{2}=14\) has no solution. Therefore, there is no solution when \(c=8\).
If \(c=7\), then
\[
a^{2}+b^{2}=94-49=45,
\]
there is a unique solution \(a=3\), \(b=6\).
If \(c=6\), then
\[
a^{2}+b^{2}=94-36=58,
\]
at this point \(2 b^{2} \geqslant 58\), which means \(b^{2} \geqslant 29\). Hence \(b \geqslant 6\), but \(b \leqslant c=6\), so \(b=6\), and in this case \(a^{2}=58-36=22\) has no solution.

In summary, there are two solutions: \((a, b, c)=(2,3,9)\) or \((a, b, c)=(3,6,7)\), with volumes \(V_{1}=2^{3}+3^{3}+9^{3}=764\left(\mathrm{~cm}^{3}\right)\) or \(V_{2}=3^{3}+6^{3}+7^{3}=586\left(\mathrm{~cm}^{3}\right)\). Therefore, the answer is A.