https://www.acmicpc.net/problem/3052



내 답안
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
boolean[] check = new boolean[42];
int cnt = 0;
for (int i=0; i<10; i++) {
int n = s.nextInt();
check[n%42] = true;
}
for (int i=0; i<check.length; i++) {
if (check[i] == true) cnt++;
}
System.out.println(cnt);
}
}
'Coding Test > 백준' 카테고리의 다른 글
[백준 4344번 - java] 평균은 넘겠지 (0) | 2021.11.12 |
---|---|
[백준 1546번 - java] 평균 (0) | 2021.11.12 |
[백준 2577번 - java] 숫자의 개수 (0) | 2021.11.08 |
[백준 2562번 - java] 최댓값 (0) | 2021.11.08 |
[백준 10818번 - java] 최소, 최대 (0) | 2021.11.08 |