백준 #2577번 숫자의 개수

jhj·2024년 2월 18일

백준 JAVA

목록 보기
386/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int mul = a * b * c;
		int[] count = new int[10];
		
		for(int i = 0; i < count.length; i++) {
			count[i] = 0;
		}
		
		while(mul != 0) {
			for(int i = 0; i < count.length; i++) {
				if(mul % 10 == i) {
					count[i]++;
				}
			}
			mul = mul / 10;
		}
		
		for(int i = 0; i < count.length; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글