ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Арифметика > задача:


50295 - Weighted Average

Гость
• Вопросы к жюри (1)

Задачи раздела

• 50363 - Class GPA Average
• 50398 - Sum of kth Anti-diagonal
• 50651 - Largest power of two
• 50388 - Number of Armstrong Num...
• 50359 - Mode of a Series
• 50440 - Call Center
• 50353 - Cube of the Largest number
• 50336 - Buying Carpets
• 50295 - Weighted Average
• 50296 - Total Discount Rate
• 50289 - Monthly Allowance
• 50559 - Faktoret e thjeshte te numrit
• 50568 - Llogaritesi i indeksit te mas...
• 50579 - Numrat pentagonal
• 50584 - Pagesa totale
• 50634 - Совершенные числа
• 50635 - Разложение на слагаемые

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 4000/7000/7000/7000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan.

Weighted Average

Sometimes, the schools use weighted average instead of calculating the standard average. In weighted average the course averages are weighted according to different criteria; like the number of hours in a week. If a lesson has one hour per week and student takes very low grade from that, it will not effect the general average much.

Weighted average is mostly calculated like this:

  • All course averages are multiplied (weighted) with the number of course hours per week
  • The results are summed
  • The sum is divided by the number of total course hours per week

Write a program that is going to read the course averages and the number of hours per week from a file and then calculate the weighted average.

Input specification
The first line has a number (n) which shows the number of lessons where 1 ≤ n ≤ 10. The following n lines contain two integer numbers each (courseAve and numHours), where 1 ≤ courseAve ≤ 10 and 1 ≤ numHours ≤ 5.

Output specification
Show one floating number with two digits precision that represent the weighted average of the student.

Sample Input:
  3
  10 4
  10 3
  6 1

Sample Output:
  9.5

Output Explanation:
   ave = ((10 * 4) + (10 * 3) + (6 * 1)) / 8 = 9.5


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

www.contester.ru