HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Sorting and sequences > problem:


50733 - The Highest Average

Guest
• Review clarifications (3)

Section problems

• 50732 - Sorting
• 50549 - k-Nearest Neighbours (kNN)
• 50290 - Minimax Sum
• 50738 - Median value
• 50317 - Student Line Up
• 50311 - Student Line Up
• 50320 - Random Sorted List
• 50736 - Top N Donors - 2
• 50733 - The Highest Average
• 50364 - Student averages
• 50333 - Series of Squares
• 50734 - Product Info (In Srt)
• 50735 - Top M Products
• 50339 - The Largest Rectangle
• 50492 - Contest Scoreboard
• 50737 - Sum of the k-largest numbers
• 50418 - Student averages

Feedback

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

Time limit 4000/7000/7000/7000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Mr. Hoxha gives math lessons in a high school. He keeps his student records in a file. He normally has two exams, two homework and two quizzes in a semester. That is a regular student takes 6 exams, but not all students can take all the exams. Sometimes because of some personal problems students skip some exams. Mr. Hoxha accepts excuses up to two exams. If a student has four, five or six exams, then his average is calculated out of the exams that he has taken. But if any student takes less than four exams his average is calculated out of four exams.

Write a program that reads the name, surname and exam information for n students and then shows the student with the highest average.

Input specification
You will be given a number (n) at the beginning. Then n lines of student information. Every line will first contain name and surname of the student followed by at most 6 integer grades where 1 ≤ n ≤ 100 and 1 ≤ everyGrade ≤ 100
The marks of every student ends with a negative number (-1).

Output specification
Show name surname and the floating point average of the student who has the highest average in the class. The average must have 2 digits precision after the floating point. If there are several students with the same max average show the first student according to the given order.

      

  Sample Input:
5
Arben Hoxha 76 50 70 80 80 -1
Artur Dardani 100 100 -1
Klevis Shehu 100 100 100 -1
Alban Mehmeti 90 90 80 82 -1
Ervin Murataj 70 70 60 70 70 80 -1  

Sample Output:
Alban Mehmeti 85.5  

Output Explanation :

Student list according to their averages

   Arben Hoxha 71.2
   Artur Dardani 50.0
   Klevis Shehu 75.0
   Alban Mehmeti 85.5
   Ervin Murataj 70.0
  According to these results, Alban Mehmeti has the highest average in the class.

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

www.contester.ru