hdu多校第八場 1010(hdu6666) Quailty and CCPC 排序/簽到

題意:ios

CCPC前10%能得金牌,給定隊伍解題數和罰時,問你有沒有一個隊伍若是向上取整就金了,四捨五入就銀了。spa

題解:code

排序後按題意求解便可。blog

#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\n", team[num].s); } } }
相關文章
相關標籤/搜索