题解 | 判断元素是否出现

判断元素是否出现

https://www.nowcoder.com/practice/0787459e92bc4360ba48b094b7f21577

#include<bits/stdc++.h>
using namespace std;
int main(){
	//write your code here......
	int n, m, x, a;
	map<int, int>map;
	cin>>n>>m;
	for(int i=0; i<n; i++){
		cin>>a;
		map[a]++;
	}
	while(m--){
		cin>>x;
		if(map.count(x)){
			 cout<<"yes"<<endl;
		}else{
			cout<<"no"<<endl;
		}
	}
	return 0;
}


全部评论

相关推荐

头像
2025-12-27 13:01
三峡大学 C++
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务