HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > Lab10 - CEN ECE > problem:


2013-04-60. 50295 - Weighted Average

Lab10 - CEN ECE

Start: Nov.28.2023 at 12:14:08 AM
Finish: Dec.14.2023 at 11:14:08 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50501 - The Highest Average
• 50463 - Drawing a Triangle
• 50466 - Drawing Square From Stars
• 14-FallResit-10. 50537 - esreveR Tri...
• 14-Spr2-40. 50438 - Pattern with stars
• 15-Fall-01. 50806 - TVSH
• 15-FallHW-1. 50820 - Post Office
• 15-PE-3. 50867 - Average of the Be...
• 2013-04-60. 50295 - Weighted ...
• 9-P4. 50899 - How Many Years

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.

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