나머지
문제
입출력 예시
내 풀이
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] arr = new int[10];
int count = 0;
for(int i = 0; i < 10; i++)
{
arr[i] = Integer.parseInt(br.readLine()) % 42;
}
for(int i = 0; i < 42; i++)
{
for(int j = 0; j < 10; j++)
{
if(arr[j] == i)
{
count++;
break;
}
}
}
System.out.print(count);
}
}