Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Average of the Nth Student
Your Informatics professor heard that you did a nice program for your math professor.
Now, he asks a favor from you :) He keeps student grades in a file.
Time to time, he wants to see student lists sorted according to averages.
Question: Write a program that
reads n students information (name, surname and 4 marks).
Then, your program will calculate the floating point average
of the students and then sort students according to
the averages in descending order. And, it will show
the kth positioned student's name surname and average.
Input specification
The first line of the input contains two integers (n and k) where n denotes
the number of students and k denotes the position of the student to show in the output
where 1 ≤ k ≤ n ≤ 2000. Each of the following n lines
will have semicolon separated information:
- Name: At most 24 chars string containing only English letters and space.
- Surname: At most 15 chars string containing only English letters.
- 4 Marks: 4 integer numbers between 0 and 100
Output specification
Show top kth student's name surname and average
(with 2 decimal places after the floating point).
Sample Input I
6 2
Johnathan; Duncan; 47 91 95 47
Diane; Peterson; 45 46 66 82
Scott Allen; Bridges; 77 47 79 73
Clyde Eloise; Rios; 57 77 98 40
Homer; Conner; 89 99 52 84
Naomi; Taylor; 64 73 69 45
|
Sample Output I
Johnathan Duncan 70
|
Output Explanation: Here is the list sorted in descending order:
- Homer Conner 81
- Johnathan Duncan 70
- Scott Allen Bridges 69
- Clyde Eloise Rios 68
- Naomi Taylor 62.75
- Diane Peterson 59.75
And thus, Johnathan Duncan has the second place with 70.
Для отправки решений необходимо выполнить вход.
|