HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Sorting and sequences > problem:


50756 - Average of the Nth Student

Guest
• Review clarifications (2)

Section problems

• 51002 - The most successful classes
• Word Puzzle
• 50740 - Service Time - 1
• 50750 - Service Time - 2
• 50347 - Selling Oranges
• 50758 - National Elections - Revisited
• 50754 - Team Standings
• 50358 - Series of Odd Numbers
• 50756 - Average of the Nth Stu...
• 50757 - National Elections - 1
• 50755- Top N Donors - 1
• 50752 - Student Groups
• 50753 - Average of the Nth Student
• 50751 - The biggest Minute
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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:

  1. Homer Conner 81
  2. Johnathan Duncan 70
  3. Scott Allen Bridges 69
  4. Clyde Eloise Rios 68
  5. Naomi Taylor 62.75
  6. Diane Peterson 59.75
And thus, Johnathan Duncan has the second place with 70.

Для отправки решений необходимо выполнить вход.

www.contester.ru