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

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


50871 - Harmonic Mean

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

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

• 50530 - Sum of Ratios
• 50384 - Permutations revisited
• 50368 - Right-most non zero digit in N!
• 50369 - Base Conversion
• 50407 - Missing Number
• 51003 - Double Prime
• 50807 - Euro to Leke
• 50433 - Sum of Cubes
• 50871 - Harmonic Mean
• 50521 - Pound to Grams
• 50432 - Numbers and Squares
• 50510 - What floor are they?
• 50870 - ZScore normalization
• 50797 - Nr of Missing Guests
• 50518 - Histogram Equalization
• 50522 - Multiplication Table - 2
• 50814 - Buying Books from Internet

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

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

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

Harmonic Mean

Harmonic mean is one of the ways to calculate the average of a series. It is the reciprocal of the arithmetic mean of reciprocals.

Question: Write a program that calculates the harmonic mean of n numbers.

Input specification
You will be first given a number n, the number of numbers where 0 ≤ n ≤ 1,000. Then, in the following line, you will be given n numbers where the numbers are floating point numbers greater than 0 and less than 50,000.

Output specification:
Show one floating point number with 2 digits precision.

Sample Input I
3
5 6 1
Sample Input II
5
8 8 1 9 7
Sample Output I
2.20
Sample Output II
3.32

Explanation: There are 3 numbers given. And, sum of reciprocals (1/5) + (1/6) + (1/1) = 1.3667 Then, the Harmonic mean is 3/1.3667 = 2.1951



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

www.contester.ru