1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 
 
public class Main {
    
    public static int[] result(int n) {
        //String is used to find out multiplied number's length
        String temp = Integer.toString(n);
        int[] beforeResult = new int[temp.length()];
        int[] afterResult = new int[10];
        
        //start putting parameter n's one's value 
        for(int i = 0; i < beforeResult.length; i++) {
            beforeResult[i] = n % 10;
            n /= 10;
        }
        
        //++ on afterResult, index of beforeResult index i value
        for(int i = 0; i < beforeResult.length; i++) {
            afterResult[beforeResult[i]]++;
        }
        
        //or
//        for(int i = 0; i < beforeResult.length; i++) {
//            afterResult[n % 10]++;
//            n /= 10;
//        }
        
        //returns the array 
        return afterResult;
    }
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        
        //receiving value and converting to int 
        String str = null;
        int[] arr = new int[3];
        int n = 0;
        while((str = br.readLine()) != null) {
            arr[n] = Integer.parseInt(str);
            n++;
            if(n == 3break;
        }
        
        //setting n to 1 for reuse as multiply result from inputted number
        n = 1;
        for(int i = 0; i < arr.length; i++) {
            n *= arr[i];
        }
        
        //result method brings result
        int[] arr2 = result(n);
        
        //prints out how many times the number has been used
        for(int i = 0; i < arr2.length; i++) {
            bw.write(arr2[i] + "\n");
        }
        bw.flush();
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

'알고리즘' 카테고리의 다른 글

백준 5단계(1546)  (0) 2019.11.28
백준 5단계(3052)  (0) 2019.11.28
백준 5단계(2920)  (0) 2019.11.28
코테 11/25/19  (0) 2019.11.25
기초 알고리즘(38번 치킨쿠폰 재귀)  (0) 2019.11.24

+ Recent posts