프로그래머스 백준 문제

2577

전한준 2024. 9. 2. 19:44

2577번: 숫자의 개수 (acmicpc.net)

 

 

 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(System.in);
        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int result=A*B*C;

        char []arr=Integer.toString(result).toCharArray();
        int []count=new int[10];
        for(int i=0;i<10;i++) {
            int temp = Integer.parseInt(String.valueOf(arr[i]));
            count[temp]++;
        }
        for(int i=0;i<10;i++){
            System.out.println(count[i]);
        }

    }
}

이부분 좀 익혀두자.

'프로그래머스 백준 문제' 카테고리의 다른 글

백준 10816 숫자카드2  (0) 2025.06.16
백준 이분탐색 2512  (0) 2025.06.16
2920  (0) 2024.09.19
백준 8958번  (0) 2024.09.02
2667번 단지 번호 붙이기  (0) 2024.07.23