hdoj 1177 "Accepted today?"

来源:互联网 发布:因笑谓迈曰 汝识之乎 编辑:程序博客网 时间:2024/06/05 08:20

是判断第m个得的奖!!

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

Input
Input contains multiple test cases. Each test case starts with five numbers N (4 =< N <= 130 -- the total number of attendees), G, S, C (1<=G<=S<=C<N --G, S, C denoting the number of golden medals, silver medals and copper medals respectively) and M (0<M<=N). The next N lines contain an integer P (1<=P<=8 --number of problems that have been solved by someone) and a time T(for example,"02:45:17", meaning 2 hours and 45 minutes and 17 seconds consumed according to contest rules) each. You can assume that all submit data are different.
A test case starting with 0 0 0 0 0 terminates input and this test case should not to be processed.
 

Output
For each case, print a sentence in a line, and it must be one of 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 62 02:45:172 02:49:012 03:17:582 03:21:294 07:55:483 04:25:423 06:57:392 02:05:022 02:16:452 02:41:370 0 0 0 0
 

Sample Output
Accepted today? I've got a silver medal :)
#include<stdio.h>typedef struct{int qu, time;}str;int main(){int n, g, s, c, m, h, min, sec, i;str st[150];while( scanf( "%d%d%d%d%d", &n, &g, &s, &c, &m ), n||g||s||c||m ){int sor = 1;for( i = 1; i <= n; i ++ ){scanf( "%d %d:%d:%d", &st[i].qu, &h, &min, &sec );st[i].time = h*3600+min*60+sec;}for( i = 1; i <= n; i ++ ){if( i!=m&&((st[m].qu<st[i].qu)||(st[m].qu==st[i].qu&&st[m].time>st[i].time)) )++sor;}if( sor <= g )printf( "Accepted today? I've got a golden medal :)\n" );else if( sor<=g+s )printf( "Accepted today? I've got a silver medal :)\n" );else if( sor <= g+s+c )printf( "Accepted today? I've got a copper medal :)\n" );elseprintf( "Accepted today? I've got an honor mentioned :)\n" );}}


0 0