文章
34
粉丝
109
获赞
7
访问
20.0k
#include <bits/stdc++.h>
using namespace std;
int main() {
map<int, int> M;
int n;
while (cin >> n) {
for (int i = 0; i < n; i++) {
int value;
cin >> value;
M[value] = value;
}
int m;
cin >> m;
for (int i = 0; i < m; i++) {
int value;
cin >> value;
if (M.find(value) == M.end()) {
printf("NO\n");
} else {
cout << "YES\n";
}
}
}
}
#include <stdio.h>
int main() {
int m, n;
scanf("%d", &n);
int a[n];
int b[m];
int c[100000] = {0};
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
c[a[i]]++;
}
scanf("%d", &m);
for (int i = 0; i < m; i++) {
scanf("%d", &b[i]);
if (c[b[i]] != 0) {
printf("YES\n");
} else {
printf("NO\n");
}
}
return 0;
}
登录后发布评论
不会啊