题解 | #查找#

查找

https://www.nowcoder.com/practice/d93db01c2ee44e8a9237d63842aca8aa

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m;
    cin>>n;
    int arr[n];
    for(int i =0;i<n;i++)cin>>arr[i];
    cin>>m;
    while(m--){
        int temp;cin>>temp;
        if(find(arr,arr+n,temp)!=arr+n)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}
// 64 位输出请用 printf("%lld")

还是set好用

全部评论

相关推荐

头像
2024-12-19 18:11
英特尔_Software_engineer
下水道鼠鼠鼠鼠:男的能去当技师吗 好进吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务