#CCBCHBA0000068. Trung bình các số không âm (Average of Nonnegative Values)
Trung bình các số không âm (Average of Nonnegative Values)
Average of Nonnegative Values
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given n real numbers, ignore negative values and average all nonnegative ones, including zero. Output EMPTY if none exist. Inputs have at most two decimal places. Round the nonnegative mean to two decimals, with exact half-cent ties rounded up.
Input
First line: n (0<=n<=10000). Exactly n decimal numbers follow, each in [-10^6,10^6] with at most two decimal places.
Output
Print EMPTY if no nonnegative values exist. Otherwise print the mean with exactly two digits after the decimal point, using half-up rounding.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input:
5
-1.00 0.00 2.00 4.00 -3.00
Output:
2.00
Explanation:
Keep 0, 2 and 4, with mean 2.00.
Example 2
Input:
3
-0.10 -5.00 -3.01
Output:
EMPTY
Explanation:
All three values are negative, so no average can be computed.
Example 3
Input:
2
0.00 0.01
Output:
0.01
Explanation:
The exact mean 0.005 rounds up to 0.01.