文章

10

粉丝

0

获赞

18

访问

550

头像
动态查找问题 题解:map
P1477
发布于2026年2月23日 11:50
阅读数 38

 

#include <map>
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	int n,q,num;
	map<int,int> m;
	cin>>n;
	while(n--)
	{
		cin>>num;
		m[num]=1;
	}
	cin>>q;
	while(q--)
	{
		cin>>num;
		if(m.count(num))
			cout<<"find"<<endl;
		else
		{
			cout<<"no"<<endl;
		 	m[num]=1;
		}
	}
	return 0
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发