백준 3052번: 나머지

2021. 8. 31. 12:10Algorithm/백준

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Baekjoon_나머지 {
	static int N;
	static int res;
	static int arr[];
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		arr = new int[42];
		for (int tc = 0; tc < 10; tc++) {
			N = Integer.parseInt(in.readLine());
			
			res = N % 42;
			
			arr[res] = 1;
		}
		
		int cnt = 0;
		
		for (int i = 0; i < arr.length; i++) {
			if(arr[i] == 1) {
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	}

}
728x90

'Algorithm > 백준' 카테고리의 다른 글

백준 2133번 : 타일 채우기 (java)  (0) 2021.09.15
백준 8958번: OX퀴즈  (0) 2021.08.31
백준 10163번 : 색종이 (java)  (0) 2021.08.25
백준 11399번: ATM (java)  (0) 2021.08.24
백준 2798번: 블랙잭 (java)  (0) 2021.08.24