코딩테스트/백준
[BJ] 2577. 숫자의 개수
jhk828
2021. 2. 9. 23:34
2577. 숫자의 개수
2577번: 숫자의 개수
첫째 줄에 A, 둘째 줄에 B, 셋째 줄에 C가 주어진다. A, B, C는 모두 100보다 같거나 크고, 1,000보다 작은 자연수이다.
www.acmicpc.net
import java.io.*;
import java.util.*;
// 210209
public class Main_2577_숫자의개수 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
int c = Integer.parseInt(br.readLine());
// String str = String.format("%d", a*b*c);
// int to String
String str = Integer.valueOf(a*b*c).toString();
int[] intArr = new int[10];
for(int i=0; i<str.length(); i++) {
intArr[str.charAt(i)-'0']++;
}
for (int i : intArr) {
sb.append(i + "\n");
}
System.out.println(sb.toString());
br.close();
} // main
}