알고리즘/백준 알고리즘
(JAVA) 백준 알고리즘 3502 문제 - 숫자의 개수 (1차원배열)
Love of fate
2020. 10. 7. 15:25
728x90
반응형
(26분)
* String 비교 String.equals()부터 먼저 쓰는게 좋다.
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
|
import java.util.Scanner;
public class MainTest2577 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
String mltpl = String.valueOf(A*B*C);
String [] mltplArr = mltpl.split("");
for(int i = 0; i < 10; i++) {
int su = 0;
for(int j =0; j < mltplArr.length; j++) {
if(mltplArr[j] == String.valueOf(i) || mltplArr[j].equals(String.valueOf(i))) {
su+=1;
}
}
System.out.println(su);
}
}
}
|
728x90
반응형