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

Сборники > Фёдор Меньшиков. Тренировки > задача:


50871 - Harmonic Mean

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

Задачи сборника

• 50295 - Weighted Average
• 50815 - Breaking the Bunker
• 50899 - How Many Years
• 50806 - TVSH
• 50820 - Post Office
• 50810 - Print Office
• 50952 - Derby Tirana
• 50807 - Euro to Leke
• 50871 - Harmonic Mean
• 50859 - Low performance
• 50508 - The Biggest Area
• 50528 - Rock-Scissors-Paper
• 50744 - The Smallest Perimeter
• 50808 - Total Distance Traveled
• 50814 - Buying Books from Internet
• 50812 - Total Discount for the clients
• 50832 - Rock Paper Scissors Lizard ...

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

Если у вас есть предложения или пожелания по работе 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