Playground/자바문제집

[백준] 2577번

미숫가루설탕많이 2023. 1. 22. 21:37
import java.util.*;
import java.io.*;
import java.math.*;

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();
      sc.close();
      
      int num = A * B * C;
      String str = Integer.toString(num);
      
      for (int i = 0; i < 10; i++) {
         int count = 0;
         for (int j = 0; j < str.length(); j++) {
            if ((str.charAt(j) - '0') == i)    // 문자열로 변환해서 인덱스 확인
               count++;
         }
         System.out.println(count);
      }
   }
}

'Playground > 자바문제집' 카테고리의 다른 글

[백준] 2742번  (0) 2023.01.22
[백준] 2675번  (0) 2023.01.22
[백준] 1271번  (0) 2023.01.22
[백준] 2475번  (0) 2023.01.22
[백준] 15964번  (0) 2023.01.22