题意:
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); } } }