본문 바로가기
Coding Test/백준

[백준 3052번 - java] 나머지

by olli2 2021. 11. 12.

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);
	}
}