-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_2577.java
More file actions
63 lines (54 loc) ยท 1.22 KB
/
_2577.java
File metadata and controls
63 lines (54 loc) ยท 1.22 KB
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
package backjoon;
// https://www.acmicpc.net/problem/2577
// ์ซ์์ ๊ฐ์
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class _2577 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
int c = Integer.parseInt(br.readLine());
int multiply = a*b*c; //a,b,c ๊ฐ๊ฐ 100๋ณด๋ค ํฌ๊ณ 1000๋ณด๋ค ์๊ธฐ๋๋ฌธ์ int๋ก ์ ์ธ
// 0๋ถํฐ 9๊น์ง์ ๋ฐฐ์ด ์์ฑ
int[] arr = new int[10];
// sol1 String์ charAt์ผ๋ก ์ฐ์ฐ
// memory 11468 runtime 76
/*
String s = String.valueOf(multiply);
for (int i = 0; i < s.length(); i++) {
arr[(s.charAt(i) - 48)]++; //๋ฌธ์์ฝ๋ '0'์ 48์ด๊ธฐ๋๋ฌธ์ 48์ ๋นผ์ค๋ค.
}
for (int v : arr) {
System.out.println(v);
}
*/
// sol2 ์๋ฆฌ์๋ก ์ฐ์ฐ
// memory 11512 runtime 76
while(multiply != 0) {
arr[multiply%10]++;
multiply/=10;
}
for(int result : arr) {
System.out.println(result);
}
}
}
/*
input
150
266
427
output
3
1
0
2
0
0
0
2
0
0
*/