Function for calculating the arithmetic mean of positive array elements

Kotlin Medium functions

Task «Function for calculating the arithmetic mean of positive array elements»

Write a function in Kotlin that takes an array of integers and returns the arithmetic mean of all positive elements in the array. If there are no positive elements, the function should return 0.0. Input data is provided via standard input: first, a number n — the number of elements, then n integers. Output the result with an accuracy of two decimal places.

Input Format

The first line contains an integer n (1 ≤ n ≤ 1000). The second line contains n integers separated by spaces.

Output Format

One real number — the arithmetic mean of the positive elements, rounded to two decimal places.

Examples

Example 1

INPUT
[{"category":"X","value":5,"active":true},{"category":"Y","value":15,"active":false}] 10 20
OUTPUT
[]
main.kt