文章

2

粉丝

10

获赞

19

访问

532

头像
数组查找 题解:C++
P1932 中南大学2023年机试题
发布于2025年3月21日 22:25
阅读数 100

#include <iostream>
#include <set>
using namespace std;

int main() {
    long long n,m;
    cin>>n>>m;
    multiset<int> set;
    for(long long i=0;i<n;i++){
            long long t;
            cin>>t;
            set.insert(t);
        }
    for(long long i=0;i<m;i++){
        long long key;
        cin>>key;
        auto it=set.find(key);
        if(it!=set.end())
            cout<<distance(set.begin(),it)<<endl;    
        else cout<<-1<<endl;
&...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发