zoukankan      html  css  js  c++  java
  • 1137 Final Grading (25 分)

    水~。

    struct Node
    {
        string id;
        int gp,gm,gf,g;
        Node()
        {
            gp=gm=gf=g=-1;
        }
        bool operator<(const Node &W) const
        {
            if(g == W.g) return id < W.id;
            return g > W.g;
        }
    };
    unordered_map<string,Node> mp;
    int p,m,n;
    
    int main()
    {
        cin>>p>>m>>n;
    
        string id;
        int score;
        while(p--)
        {
            cin>>id>>score;
            mp[id].id=id;
            mp[id].gp=score;
        }
        while(m--)
        {
            cin>>id>>score;
            mp[id].id=id;
            mp[id].gm=score;
        }
        while(n--)
        {
            cin>>id>>score;
            mp[id].id=id;
            mp[id].gf=score;
        }
        for(auto &t:mp)
            if(t.se.gm > t.se.gf)
                t.se.g=round(t.se.gm*0.4+t.se.gf*0.6);
            else
                t.se.g=t.se.gf;
    
        vector<Node> res;
        for(auto t:mp)
        {
            if(t.se.gp >= 200 && t.se.g >= 60 && t.se.g <= 200)
                res.pb(t.se);
        }
    
        sort(res.begin(),res.end());
        for(auto t:res)
            cout<<t.id<<' '<<t.gp<<' '<<t.gm<<' '<<t.gf<<' '<<t.g<<endl;
        //system("pause");
        return 0;
    }
    
  • 相关阅读:
    Ajax返回DataSet时
    spring(8)
    spring(12)
    spring(6)
    spring(11)
    spring(10)
    spring(5)
    spring(3)
    spring(9)
    spring(7)
  • 原文地址:https://www.cnblogs.com/fxh0707/p/14477359.html
Copyright © 2011-2022 走看看