매일코테

백준 4단계 no.3

공주맛밤 2022. 7. 22. 11:28

import java.util.*;

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 x = a*b*c;

        int[] arr = new int[10];

        while (x != 0) {
            int i = x%10;

            arr[i]++;

            x /= 10;
        }

        for (int j = 0; j < arr.length; j++) {
            System.out.println(arr[j]);
        }
    }
}

틀린이유 -> 0부터 9까지 9개 라고 생각했다..(10개임)

728x90
반응형