HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50756 - Average of the Nth Student

Guest
• Review clarifications (2)

Volume problems

• 51019 - Finding the hidden message
• 51002 - The most successful classes
• 50525 - Ordering Pizza
• 50342 - 100 Factorial
• 50524 - Elevator
• 50531 - File Decryption
• 50758 - National Elections - Revisited
• 50687 - Pascal Triangle - 2
• 50756 - Average of the Nth Stu...
• 50457 - The Number of Winners
• 50752 - Student Groups
• 50451 - Processing Cost
• 50751 - The biggest Minute
• 50468 - Draw Matrix - 2
• 50470 - Close Pairs - Revised
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon

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