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

Турниры > CEN112 Questions 2016 > задача:


15-PE-7. 50871 - Harmonic Mean

CEN112 Questions 2016

Старт: 30.мар.2016 в 15:10:22
Финиш: 01.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• 15-MdtE-3. 50913 - Manhattan Distance
• 15-MdtE-4. 50917 - Descending Nu...
• 15-MdtE-5. 50912 - Trip to Librazhd
• 15-MdtE-6. 50914 - Buy 3, Pay 2
• 15-PE-1. 50865 - Apartment Building...
• 15-PE-2. 50866 - Buy the cheapest
• 15-PE-4. 50868 - Sort Frequencies
• 15-PE-5. 50869 - Birthday Celebration
• 15-PE-7. 50871 - Harmonic Mean
• 15-PE-8. 50872 - Top M Grades
• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...
• 15-PE2-2. 50984 - Top m hardworki...
• 15-PE2-2. 51086 - Top popular student
• 15-PE2-3. 50982 - A thief in labyrinth
• 15-PE2-4. 50983 - Course Selection
• 15-PE2-6. 50985 - Books Waiting

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

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