L2-019 悄悄关注 (25 分)

水题~。

const int N=5010,M=10010;
string follow[N];
unordered_set<string> S;
pair<string,int> name[M];
int n,m;

int main()
{
    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>follow[i];
        S.insert(follow[i]);
    }

    cin>>m;
    double sum=0;
    for(int i=0;i<m;i++)
    {
        cin>>name[i].fi>>name[i].se;
        sum+=name[i].se;
    }

    double avg=sum/m;
    set<string> res;
    for(int i=0;i<m;i++)
        if(!S.count(name[i].fi) && name[i].se > avg)
            res.insert(name[i].fi);

    if(res.size() == 0)
        puts("Bing Mei You");
    else
    {
        for(auto t:res)
            cout<<t<<endl;
    }

    //system("pause");
    return 0;
}
posted @ 2021-04-22 11:45  Dazzling!  阅读(32)  评论(0编辑  收藏  举报