Algorithm
백준_나머지_3052
Young_J
2020. 12. 17. 23:26
//알고리즘
1. 간단한 연산
2. HashSet 사용
-> 간단한 연산코드이지만 HashSet으로 결과를 저장하면 쉽게 구현할 수 있음
더보기
import java.util.HashSet;
import java.util.Scanner;
public class 나머지_3052 {
static int arr[];
static final int div = 42;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashSet<Integer> set = new HashSet<Integer>();
for (int i = 0; i < 10; i++) {
set.add(sc.nextInt()%42);
}
System.out.println(set.size());
}
}
※ 쉬운문제이지만 다양한 자료구조를 사용해보기위해 선택한 문제.