题解 | #查找#

查找

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好用

全部评论

相关推荐

不愿透露姓名的神秘牛友
06-25 20:45
点赞 评论 收藏
分享
野猪不是猪🐗:我assume that你must技术aspect是solid的,temperament也挺good的,however面试不太serious,generally会feel style上不够sharp
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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