1. 문제 링크
10816호: 넘버카드 2
첫 번째 줄에는 상근이 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 두 번째 줄에는 숫자 카드에 적힌 정수가 포함됩니다. 숫자 카드에 적힌 숫자는 -10,000,000 이상, 10,
www.acmicpc.net
2. 문제 및 입/출력 예시

3. 문제 해결
숫자카드에 적힌 정수와 숫자를 지도에 넣어보세요.
containsKey()를 사용하여 입력한 숫자가 맵에 있는지 확인하고 출력합니다.
4. 코드
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
public class Main {
public static void main(String() args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int N = Integer.parseInt(br.readLine());
String() split = br.readLine().split(" ");
HashMap<Integer, Integer> map = new HashMap<>();
for(int i=0;i<N;i++) {
int num = Integer.parseInt(split(i));
if(map.containsKey(num)) {
map.put(num, map.get(num)+1);
}
else {
map.put(num, 1);
}
}
int M = Integer.parseInt(br.readLine());
split = br.readLine().split(" ");
for(int i=0;i<M;i++) {
int num = Integer.parseInt(split(i));
if(map.containsKey(num)) {
sb.append(map.get(num)+" ");
}
else {
sb.append("0 ");
}
}
System.out.println(sb);
}
}