숫자의 길이와 자릿수를 구할 수 있다면 해결할 수 있는 문제입니다.
#include <iostream>
int main()
{
int a, b, c;
int cnts[10];
for (int i = 0; i < 10; i++)
cnts[i] = 0;
std::cin >> a >> b >> c;
int n = a * b * c;
int len = 0; // 숫자 길이
int copy_n = n;
while (copy_n > 0)
{
copy_n /= 10;
len++;
}
int first_ten = 10;
for (int i = 1; i < len; i++)
first_ten *= 10;
for (int i = 0; i < len; i++) // 자릿수 구하기
{
int temp = (n % first_ten / (first_ten / 10));
first_ten /= 10;
cnts[temp]++;
}
for (int i = 0; i < 10; i++)
std::cout << cnts[i] << "\n";
return 0;
}