본문 바로가기
Beakjoon&프로그래머스/Java

[백준/Java] 3052번 나머지

by 현장 2022. 4. 18.

-Code

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();

        for (int i = 0; i < 10; i++){
            int num = sc.nextInt() % 42;
            if (!list.contains(num)){
                list.add(num);
            }
        }

        System.out.println(list.size());
    }
}