HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


061. 50733 - The Highest Average

Guest
• Review clarifications (3)

Volume problems

• 016. 50459 - The Biggest Digit
• 020. 50575 - Number of Prime num...
• 030. 50576 - Number of Perfect nu...
• 035. 50467 - Random Numbers
• 040. 50354 - Intersecting Rectangles
• 050. 50510 - What floor are they?
• 050. 50566 - Grade Point Average (...
• 060. 50727 - Fibonacci Numbers
• 061. 50733 - The Highest Average
• 062. 50390 - Total Salary Paid
• 066. 50523 - Total Tax to Pay
• 070. 50534 - Top Trading Company
• 076. 50289 - Monthly Allowance
• 080. 50347 - Selling Oranges
• 090. 50378 - Sum of the given digits
• 095. 50453 - The Cubic Difference
• 100. 50397 - The Number of Points ...

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