ACM HDU 1177「Accepted today?(簡単な問題)
11683 ワード
"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 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<=CA 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 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
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1476 Accepted Submission(s): 649
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
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 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
#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%d%d%d%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 :)
");
else if(i<=G+S) printf("Accepted today? I've got a silver medal :)
");
else if(i<=G+S+C) printf("Accepted today? I've got a copper medal :)
");
else printf("Accepted today? I've got an honor mentioned :)
");
}
return 0;
}