HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > SEM 2 - W6 > problem:


13-Fall2-60. 50756 - Average of the Nth Student

SEM 2 - W6

Start: Apr.11.2023 at 04:57:14 PM
Finish: Apr.17.2023 at 08:57:14 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 50364 - Student averages
• 50757 - National Elections - 1
• 50755- Top N Donors - 1
• 13-Fall2-60. 50756 - Average of...

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