Acm hdu 1177 "accepted today ?" (Simple question)

Source: Internet
Author: User
"Accepted today? "

Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 1476 accepted submission (s): 649

Problem descriptiondo 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 has accepted today? Alimama

Inputinput 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 shocould not to be processed.

Outputfor 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 input10 1 2 3 6
02:45:17
02:49:01
03:17:58
03:21:29
4 07:55:48
3 04:25:42
3 06:57:39
02:05:02
02:16:45
02:41:37
0 0 0 0 0

Sample outputaccepted today? I 've got a silver medal

Authorlcy
# Include  <  Stdio. h  >  
# Include < Algorithm >
# Include < String . H >
# Include < Iostream >
Using Namespace STD;
Struct Node
{
Int Num;
Char Time [ 15 ];
} Students [ 150 ];
Bool CMP (node A, Node B)
{
If (A. Num > B. Num) Return 1 ;
Else If (A. Num = B. Num && Strcmp (A. Time, B. Time) < 0 ) Return 1 ;
Else Return 0 ;
}
Int Main ()
{
Int N, G, S, C, M;
Int Num1, I;
Char Time1 [ 15 ];
While (Scanf ( " % D " , & N, & G, & S, & C, & M ))
{
If (N = 0 && G = 0 && S = 0 && C = 0 && M = 0 ) Break ;
For (I = 0 ; I < N; I ++ )
{
Scanf ( " % D % s " , & Students [I]. Num, & Students [I]. time );
}
Num1 = Students [m - 1 ]. Num;
Strcpy (time1, students [m - 1 ]. Time );
Sort (students, students + N, CMP );
For (I = 0 ; I < N; I ++ )
{
If (STUDENTS [I]. Num = Num1 && Strcmp (students [I]. Time, time1) = 0 ) Break ;
}
I ++ ;
If (I <= G) printf ( " Accepted today? I 've got a golden medal :) \ n " );
Else If (I <= G + S) printf ( " Accepted today? I 've got a silver medal :) \ n " );
Else If (I <= G + S + C) printf ( " Accepted today? I 've got a copper medal :) \ n " );
Else Printf ( " Accepted today? I 've got an honor mentioned :) \ n " );
}
Return 0 ;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.