文章
34
粉丝
18
获赞
6
访问
14.4k
#include <iostream>
#include <string.h>
using namespace std;
int n,m,a[1000],x,f[1000];
int main(){
int n;
while(cin >> n){
memset(f,0,sizeof(f));
for(int i = 0;i < n;i ++){
cin >> a[i];
f[a[i]] ++;
}
cin >> m;
while(m --){
cin >> x;
if(f[x])cout << "YES" << endl;
else cout << "NO" << endl;
}
}
return 0;
}
#include <iostream>
#include <map>
using namespace std;
int n,m,x;
int main(){
map<int,int> mymap;
while(cin >> n){
for(int i = 0;i < n;i ++){
cin >> x;
mymap[x] ++;
}
cin >> m;
while(m --){
cin >> x;
if(mymap[x])cout << "YES" << endl;
else cout << "NO" << endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发