Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
36 lines (30 loc) · 1001 Bytes

File metadata and controls

36 lines (30 loc) · 1001 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// N(가게의 부품 개수)
int n = sc.nextInt();
// 집합(Set) 정보를 처리하기 위한 HashSet 라이브러리
HashSet<Integer> s = new HashSet<>();
for (int i = 0; i < n; i++) {
int x = sc.nextInt();
s.add(x);
}
// M(손님이 확인 요청한 부품 개수)
int m = sc.nextInt();
int[] targets = new int[n];
for (int i = 0; i < m; i++) {
targets[i] = sc.nextInt();
}
// 손님이 확인 요청한 부품 번호를 하나씩 확인
for (int i = 0; i < m; i++) {
// 해당 부품이 존재하는지 확인
if (s.contains(targets[i])) {
System.out.print("yes ");
}
else {
System.out.print("no ");
}
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.