ZZULI_SUMMER_PRACTICE(7) 1177  "…

来源:互联网 发布:淘宝店高达 编辑:程序博客网 时间:2024/05/18 01:05
"Accepted today?"

Time Limit: 2000/1000 MS(Java/Others)    Memory Limit:65536/32768 K (Java/Others)
Total Submission(s): 1443   Accepted Submission(s):631


Problem Description
Do you remember a sentence "Accepted today?" Yes, the sentenceis mentioned frequently in lcy's course "ACM Programming"!
The contest is still in progress this moment. How excited itis! You, smart programmer, must have AC some problems today. "Can Iget copper medal, silver medal, or even golden medal?" Oh, ha-ha!You must be considering this question. And now, the last problem ofthis contest comes.
Give you all submitting data in the contest, and tell you thenumber of golden medals, silver medals and copper medals; your taskis to output someone's contest result.
Easy? Of course! I t is the reason that I designed theproblem.
When you have completed this contest, please remember thatsentence〃 Accepted today?〃兒
 

Input
Input contains multiple test cases. Each test case starts withfive numbers N (4 =< N <= 130 -- thetotal number of attendees), G, S, C(1<=G<=S<=C<N--G, S, C denoting the number of golden medals, silver medals andcopper medals respectively) and M(0<M<=N). The next N lines contain aninteger P (1<=P<=8 --number ofproblems that have been solved by someone) and a time T(forexample,"02:45:17", meaning 2 hours and 45 minutes and 17 secondsconsumed according to contest rules) each. You can assume that allsubmit data are different.
A test case starting with 0 0 0 0 0 terminates input and thistest case should not to be processed.
 

Output
For each case, print a sentence in a line, and it must be oneof these sentences:
Accepted today? I've got a golden medal :)
Accepted today? I've got a silver medal :)
Accepted today? I've got a copper medal :)
Accepted today? I've got an honor mentioned :)

Note: 
You will get an honor mentioned if you can't get copper medal,silver medal or golden medal.
 

Sample Input
10 1 2 3 6
2 02:45:17
2 02:49:01
2 03:17:58
2 03:21:29
4 07:55:48
3 04:25:42
3 06:57:39
2 02:05:02
2 02:16:45
2 02:41:37
0 0 0 0 0
 

Sample Output
Accepted today? I've got a silver medal :)
 

Author
lcy
简单题就是求序号为m的那个得了什么奖牌,
代码:
#include<stdio.h>
#include<stdlib.h>
struct point{
int problem,time,index;
}map[150];
int cmp(const void *a,const void *b)
{
struct point *c,*d;
c=(struct point *)a;
d=(struct point *)b;
if(c->problem!=d->problem)
returnd->problem-c->problem;
else returnc->time-d->time;
}
int main()
{
int hour,minute,second,i,n,g,s,c,m;
while(scanf("%d%d%d%d%d",&n,&g,&s,&c,&m),n||g||s||c)
{
for(i=0;i<n;i++)
{
scanf("%d%d:%d:%d",&map[i].problem,&hour,&minute,&second);
map[i].time=hour*3600+minute*60+second;
map[i].index=i+1;
}

qsort(map,n,sizeof(map[0]),cmp);
for(i=0;i<n;i++)
if(map[i].index==m)break;
if(i>=0&&i<g)printf("Acceptedtoday? I've got a golden medal :)\n");
elseif(i>=g&&i<g+s)printf("Acceptedtoday? I've got a silver medal :)\n");
elseif(i>=g+s&&i<g+s+c)printf("Acceptedtoday? I've got a copper medal :)\n");
else printf("Accepted today? I've got an honor mentioned:)\n");
}
return 0;
}

原创粉丝点击