HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50756 - Average of the Nth Student

Guest
• Review clarifications (2)

Volume problems

• 50587 - Modular Conversion
• 030. 50737 - Sum of the k-largest n...
• 50419 - The longest bitonic sequence
• 50317 - Student Line Up
• 50311 - Student Line Up
• 50398 - Sum of kth Anti-diagonal
• 50323 - Filtering Contact List
• 50364 - Student averages
• 50756 - Average of the Nth Stu...
• 50758 - National Elections - Revisited
• 50458 - Weekly Report
• Raporti Javor
• 50555 - Frequency of Letters
• 50592 - Matrix Multiplication
• 50653 - Long Divide
• 50767 - Censor
• 50792 - The student with the highest...

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