文章

62

粉丝

66

获赞

62

访问

4.5k

头像
查找1 (C++ 11)题解:
P1388 北京邮电大学
发布于2024年4月27日 00:21
阅读数 60

#include<bits/stdc++.h>
using namespace std;

unordered_map<int, bool> st;
int n, m;

int main()
{
    while(cin >> n)
    {
        for(auto k : st)
            st[k.first] = false;
        while(n --)
        {
            int x;
            cin >> x;
            st[x] = true;
        }
        
        cin >> m;
        while(m --)
        {
            int x;
            cin >> x;
            if(st[x]) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
    
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发