import java.util.Scanner;
public class Main2577 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int A = s.nextInt();
int B = s.nextInt();
int C = s.nextInt();
int result = A * B * C;
int[] cnt = new int[10];
String answer = result + "";
int num = 0;
for (int i = 0; i < answer.length(); i++) {
for (int j = 0; j < cnt.length; j++) {
if (j == (answer.charAt(i) - '0')) {
cnt[j]++;
}
}
}
for (int i = 0; i < cnt.length; i++)
System.out.println(cnt[i]);
}
}
세개 정수의 곱을 문자열로 변환후, chatAt으로 추출해 값을 비교하였다. 문자정수를 숫자 정수로 바꿀라면 문자 '0'을 빼주면 된다.
'휴지통 > 알고리즘 & 자료구조' 카테고리의 다른 글
순차 탐색 (0) | 2021.07.07 |
---|---|
백준 3052 (0) | 2021.07.07 |
백준 2562 (0) | 2021.07.07 |
백준 10818 (0) | 2021.07.07 |
퀵 정렬(Quick Sort) (0) | 2021.07.06 |