#CCBCHBON0000035. Bỏ số 0 khi tính trung bình (Average Excluding Zeros)
Bỏ số 0 khi tính trung bình (Average Excluding Zeros)
Average Excluding Zeros
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Ignore all zero entries. Average the remaining values; output EMPTY if none. Otherwise print exactly two decimals, rounding halfway away from zero, including negative ties. Print 0.00 for zero.
Input
First n (1<=n<=100000), followed by exactly n integers in [-10^6,10^6].
Output
Print EMPTY or a decimal with exactly two digits after the point.
Subtasks
-
Subtask 1 (20%): ; .
-
Subtask 2 (30%): ; .
-
Subtask 3 (50%): ; .
Examples
Example 1
Input:
5
0 -1 2 0 4
Output:
1.67
Explanation:
Exclude zeros from sum and count, rounding ties away from zero. Result: 1.67.
Example 2
Input:
3
0 0 0
Output:
EMPTY
Explanation:
Exclude zeros from sum and count, rounding ties away from zero. Result: EMPTY.
Example 3
Input:
8
1 1 1 1 1 1 1 -2
Output:
0.63
Explanation:
Exclude zeros from sum and count, rounding ties away from zero. Result: 0.63.