HDU 1177 "Accepted today?" 水题

来源:互联网 发布:阿里云国际版配置 编辑:程序博客网 时间:2024/06/02 04:12

题意:在一场比赛中,你会拿到什么奖牌?

思路:排序一遍即可。

http://acm.hdu.edu.cn/showproblem.php?pid=1177

/*********************************************    Problem : HDU 1177    Author  : NMfloat    InkTime (c) NM . All Rights Reserved .********************************************/#include <map>#include <set>#include <queue>#include <cmath>#include <ctime>#include <cstdio>#include <cstring>#include <cstdlib>#include <iostream>#include <algorithm>#define rep(i,a,b)  for(int i = (a) ; i <= (b) ; i ++)#define rrep(i,a,b) for(int i = (b) ; i >= (a) ; i --)#define repE(p,u) for(Edge * p = G[u].first ; p ; p = p -> next)#define cls(a,x)   memset(a,x,sizeof(a))#define eps 1e-8using namespace std;const int MOD = 1e9+7;const int INF = 0x3f3f3f3f;const int MAXN = 1e5+5;const int MAXE = 2e5+5;typedef long long LL;typedef unsigned long long ULL;int T,n,m,k,G,S,B;struct Node {    int num ; //题数    int time ; //时间    int idx ;}A[150];bool cmp(Node a1,Node a2) {    if(a1.num == a2.num) {        return a1.time < a2.time;    }    return a1.num > a2.num;}void input() {    int tim,min,sec;    rep(i,1,n) {        scanf("%d %d:%d:%d",&A[i].num,&tim,&min,&sec);        A[i].time = tim * 3600 + min * 60 + sec;        A[i].idx = i;    }}void solve() {    sort(A+1,A+1+n,cmp);    int pos ;    rep(i,1,n) {        if(A[i].idx == m) {            pos = i;            break;        }    }    if(pos <= G) puts("Accepted today? I've got a golden medal :)");    else if(pos <= G + S) puts("Accepted today? I've got a silver medal :)");    else if(pos <= G + S + B) puts("Accepted today? I've got a copper medal :)");    else puts("Accepted today? I've got an honor mentioned :)");}int main(void) {    //freopen("a.in","r",stdin);    //scanf("%d",&T); while(T--) {    //while(~scanf("%d %d",&n,&m)) {    while(scanf("%d%d%d%d%d",&n,&G,&S,&B,&m),n) {        input();        solve();    }    return 0;}
0 0
原创粉丝点击