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

判断元素是否出现

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;
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 11:29
点赞 评论 收藏
分享
07-09 15:55
门头沟学院 Java
点赞 评论 收藏
分享
每晚夜里独自颤抖:要求太多的没必要理
点赞 评论 收藏
分享
晗江雪:其实我只是觉得你们导员说的很好笑
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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