题解 | #判断元素是否出现#

判断元素是否出现

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

#include<bits/stdc++.h>
#include <cstddef>
#include <map>
using namespace std;
int main(){
	//write your code here......
	int n,num ;
	cin >> n;
	cin>>num;

	map<int,int>maps;
	for(int i = 0 ; i < n; i++ ){
		int key;
		cin >> key;
		maps[key] = 1;
	}

	for(int i =0;i < num;i++){
		int key;
		cin >> key;
		if(maps[key] != NULL){
			cout << "yes"<<endl;
		}else{
			cout << "no"<<endl;
		}
	}

	







	return 0;
}

全部评论

相关推荐

09-17 10:53
四川大学 C++
loveTy:你这些技能对大厂没用,而且四川大学因为之前地铁那个事件上了不少民营企业的黑名单。 去试一试国企,他们的黑名单没民营那么狠
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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