Home > Back-end >  Hdu 1177
Hdu 1177

Time:10-29


The 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 the 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. The difference You all date 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, do remember that sentence "Accepted today? "Son



Input
Input contains multiple test cases. Each test case starts with five Numbers N (4=& lt; N & lt;=130 -- the total number of attendees), G, S, C (1 & lt;=G<=S<=C


The 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.



The 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




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

# include & lt; iostream>
# include & lt; String. H>
using namespace std;
Int main () {
Int N, G, S, C, M, I, j;
Char a [150] [15].
While (cin> N) {
cin> G> S;
cin> C> M;
If (N==0 & amp; & G==0 & amp; & S==0 & amp; & C==0 & amp; & M==0)
break;
for(i=0; iCin. Getline (a [I], 15);
Int [150] b={0}, k=1;
for(i=0; ifor(j=0; A [I] [j].=' '; J++)
[I] b=b * 10 + [I] a [I] [j] - '0'; }
for(i=0; iIf (b [I] & gt; B] [M - 1)
K++;
If (b [I]==b] [M - 1 & amp; & STRCMP (a [I], a [M - 1)) & lt; 0)
K++; }
If (k<=G)
cout<" Accepted today? I 've got a golden medal:) "& lt; Else if (k - G<=S& & K - G> 0)
cout<" Accepted today? I 've got a silver medal:) "& lt; Else if (k - G - S<=C& & K - G - S> 0)
cout<" Accepted today? I 've got a copper medal:) "& lt; The else
cout<" Accepted today? I 've got an honor "mentioned:) & lt;
Barking up

CodePudding user response:

How do I think you are thinking is not right, or my English understanding is wrong?
Should be the average time to figure out the answer, or haven't had the significance on the number of questions in each row,

CodePudding user response:

? Each line is different players

CodePudding user response:

reference 1st floor qybao response:
how do I think you are thinking is not right, or am I wrong understanding in English?
Should be the average time to figure out the answer, or haven't had the significance on the number of questions in each row,

Compare the answer, M refers to how many contestants

CodePudding user response:

reference 1st floor qybao response:
how do I think you are thinking is not right, or am I wrong understanding in English?
Should be the average time to figure out the answer, or haven't had the significance on the number of questions in each row,

Again, the same number should not be first than answer than time

CodePudding user response:

M is how many contestants, GSC of golds, N is the number I know, just don't see to find M ranking rules (the answer what's the meaning of number and problem solving time), so think to calculate the average reading time, otherwise, such as answer ten questions need 24 hours, answer 1 question need 3 hours, who is the first?

CodePudding user response:

Your problem is wrong to believe in yourself too much input and output ability of the
cin> M; After the return is still within the buffer
The next getline is the first group of data obtained is a carriage return, in other words, a blank line
So the back all wrong

CodePudding user response:

The original did not give M is what meaning is
M is according to the original poster is to judge the first M lines of the data, what can get MEDALS
Each row of p, the bigger the row in front of and behind the time yue xiaoyue row behind
The building Lord among b array, make p into integer
To record with k M rank, the default is the first
Then cycle, if b array to record the corresponding person than M p p value is high, the k++, i.e., M ranked lower a
If both p, same time smaller than M, M a lower rank a
That is probably mean

Error getline read data is wrong again, with the back of the algorithm is useless

CodePudding user response:

In cin> M;
Then, according to the code of your style, add
cin> Getline (a [0], 15); Run a line of the buffer are extracted from the carriage return will solve the problem

CodePudding user response:

thank you

CodePudding user response:

Ac,,,,,,,,,
  • Related