Submit | All submissions | Best solutions | Back to list |
MEANSTRIC - Tricky Means |
Given n strictly positive real numbers, your task is to compute the Pythagorean means:
- The arithmetic mean « A »
- The geometric mean « G » (mean of rates of growth)
G =
- The harmonic mean « H » (mean of speeds)
Figure 1: Geometric interpretation of the Pythagorean means of two numbers a and b
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. Each test case is described in two lines: the first line contains a single integer « n » (1 ≤ n ≤ 100) indicating the number of the strictly positive real numbers and the second line contains « n » space-separated strictly positive real numbers.
Output
For each test case, print a single line containing three space-separated integers: « A », « G », « H » which are respectively the arithmetic, the geometric and the harmonic means of the given strictly positive real numbers. Each mean must be given with a precision of 10-9.
Example
Input: 3 5 4 36 45 50 75 6 1.0 2.0 4.0 7.0 14.0 28.0 8 1.0 2.0 3.0 4.0 9.0 12.0 18.0 36.0 Output: 42.000000000 30.000000000 15.000000000 9.333333333 5.291502622 3.000000000 10.625000000 6.000000000 3.388235294
Added by: | mbk_live |
Date: | 2019-01-08 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C-CLANG C NCSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG C99 JAVA JULIA PYTHON PYPY3 PYTHON3 SWIFT |