• hdu多校第八场 1010(hdu6666) Quailty and CCPC 排序/签到


    题意:

    CCPC前10%能得金牌,给定队伍解题数和罚时,问你有没有一个队伍如果向上取整就金了,四舍五入就银了。

    题解:

    排序后按题意求解即可。

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<string>
    #include<stack>
    #include<algorithm>
    #include<map>
    #include<queue>
    #include<vector>
    using namespace std;
    #define INF 0x3f3f3f3f
    #define MAXN 100000+50
    #define MAXM 30000
    #define ll long long
    #define per(i,n,m) for(int i=n;i>=m;--i)
    #define rep(i,n,m) for(int i=n;i<=m;++i)
    #define mod 1000000000 + 7
    #define mian main
    #define mem(a, b) memset(a, b, sizeof a)
    #ifndef ONLINE_JUDGE
    #define dbg(x) cout << #x << "=" << x << endl;
    #else
    #define dbg(x)
    #endif
    inline int read()
    {
        int x = 0, f = 1;
        char ch = getchar();
        while (ch < '0' || ch > '9')
        {
            if (ch == '-')
                f = -1;
            ch = getchar();
        }
        while (ch >= '0' && ch <= '9')
        {
            x = 10 * x + ch - '0';
            ch = getchar();
        }
        return x * f;
    }
    inline ll readll()
    {
        ll x = 0, f = 1;
        char ch = getchar();
        while (ch < '0' || ch > '9')
        {
            if (ch == '-')
                f = -1;
            ch = getchar();
        }
        while (ch >= '0' && ch <= '9')
        {
            x = 10 * x + ch - '0';
            ch = getchar();
        }
        return x * f;
    }
    struct Team {
        char s[15];
        int p, t;
    }team[MAXN];
    bool cmp(Team &a, Team &b)
    {
        if (a.p == b.p) return a.t < b.t;
        return a.p > b.p;
    }
    int main()
    {
        //std::ios::sync_with_stdio(false);
        int _ = read();
        while (_--)
        {
            int n = read();
            int d = read();
            rep(i, 1, n)
            {
                scanf("%s", team[i].s);
                team[i].p = read(), team[i].t = read();
            }
            sort(team + 1, team + n + 1,cmp);
            int num = n * d ;
            if (num%10 !=5)
            {
                puts("Quailty is very great");
            }
            else
            {
                num /= 10;
                num++;
                printf("%s
    ", team[num].s);
            }
        }
    }
  • 相关阅读:
    二维数组求矩形最大子数组和
    关于返回一个整数数组中最大子数组的和的问题(详细版)
    学习进度第三周
    人月神话阅读笔记03
    团队开发项目-NABCD模型
    第七周学习总结
    人月神话阅读笔记01
    第六周学习总结
    大道至简阅读笔记03
    结对开发地铁查询
  • 原文地址:https://www.cnblogs.com/isakovsky/p/11355132.html
Copyright © 2020-2023  润新知