Function for calculating the arithmetic mean and the number of elements greater than the mean
Go
Medium
functions
Task «Function for calculating the arithmetic mean and the number of elements greater than the mean»
Write a function `AverageAndAbove` that takes a slice of integers and returns the arithmetic mean (type float64) and the number of elements that are greater than this mean. If the slice is empty, return 0.0 and 0. The function must be exported (start with a capital letter).
Input Format
The first line contains an integer N (0 ≤ N ≤ 1000) — the number of elements. The second line contains N integers separated by spaces.
Output Format
Two numbers: the arithmetic mean with an accuracy of two decimal places and the number of elements exceeding the mean.
Examples
Example 1
INPUT
5
-2
3
0
-5
8
1
OUTPUT
0.80 2
Example 2
INPUT
4
-1 0 1 2
OUTPUT
0.50 2
Example 3
INPUT
4
1
2
3
4
0
OUTPUT
2.50 2
Example 4
INPUT
0
OUTPUT
0.00 0
main.go