• HDU/5499/模拟


    题目链接
    模拟题,直接看代码。
    £:分数的计算方法,要用double;

    #include <set>
    #include <map>
    #include <cmath>
    #include <queue>
    #include <cstdio>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    typedef pair<int, int> pa;
    typedef long long  LL;
    const int maxn=100+100;
    struct node
    {
        string na;
        double a;
        double b;
        double ans;
        bool operator<(const node x)const
        {
            return x.ans<ans;
        }
    };
    node man  [maxn];
    node woman[maxn];
    node t    [maxn];
    string x1,x2;
    double t1=0.0,t2=0.0;
    void init()
    {
        for(int i=0;i<=100+1;i++)
        {
            woman[i].ans=0;
            man  [i].ans=0;
            t    [i].ans=0;
        }
    }
    
    int main ()
    {
        int T;
        scanf("%d",&T);
        while(T--)
        {
            init();
            int n,m;
            scanf("%d%d",&n,&m);
            int k1=0,k2=0;
            bool fg=0;
            double xx=0.0,yy=0.0;
            for(int i=0;i<n;i++)
            {
                cin>>x1>>x2>>t1>>t2;
                if(x2[0]=='m')
                {
                    man[k1].na=x1;
                    man[k1].a=t1;
                    man[k1].b=t2;
                    xx=max(xx,t1);
                    yy=max(yy,t2);
                    k1++;
                }
                else
                {
                    fg=1;
                    woman[k2].na=x1;
                    woman[k2].a=t1;
                    woman[k2].b=t2;
                    xx=max(xx,t1);
                    yy=max(yy,t2);
                    k2++;
                }
            }
    
    
    
            xx=(double)300.0/(double)xx;
            yy=(double)300.0/(double)yy;
            for(int i=0;i<k1;i++)
                man[i].ans=(double)man[i].a*xx*0.3+man[i].b*yy*0.7;
            for(int i=0;i<k2;i++)
                woman[i].ans=(double)woman[i].a*xx*0.3+woman[i].b*yy*0.7;
    
    
        sort(woman,woman+k2);
    
    
    
    
            if(fg)
            {
                int k=0;
                t[k].na=woman[0].na;
                t[k].ans=woman[0].ans;
                k++;
                for(int i=1;i<k2;i++)
                {
                    man[k1].na=woman[i].na;
                    man[k1].ans=woman[i].ans;
                    k1++;
                }
                sort(man,man+k1);
                for(int i=0;i<m-1;i++)
                {
                    t[k].na=man[i].na;
                    t[k].ans=man[i].ans;
                    k++;
                }
                sort(t,t+m);
                cout<<"The member list of Shandong team is as follows:"<<endl;
                for(int i=0;i<m;i++)
                    cout<<t[i].na<<endl;
            }
            else
            {
                for(int i=0;i<k2;i++)
                {
                    man[k1].na=woman[i].na;
                    man[k1].ans=woman[i].ans;
                    k1++;
                }
                sort(man,man+k1);
                cout<<"The member list of Shandong team is as follows:"<<endl;
                for(int i=0;i<m;i++)
                    cout<<man[i].na<<endl;
            }
        }
        return 0;
    }
    想的太多,做的太少。
  • 相关阅读:
    POI_Excel表格数据导入导出实例--支持xls/xlsx格式
    js图片压缩工具---base64码上传插件,兼容h5和微信端(lrz.mobile.min.js)
    同一个页面,加载不同版本jQuery
    This method isn't transactional
    jquery.cookie的使用,记住用户名
    正则表达式 2017/6/12
    kSet 2017/6/6
    差分与二维差分
    求组合数
    高精度
  • 原文地址:https://www.cnblogs.com/pealicx/p/6115611.html
Copyright © 2020-2023  润新知