#C4679. Outage Probability Calculation
Outage Probability Calculation
Outage Probability Calculation
In this problem, you are given an integer n representing the number of minutes in the outage history, and a sequence h of n integers where each integer is either 0 (no outage) or 1 (an outage). Your task is to calculate the probability that the next minute will experience an outage.
The probability is computed using the formula:
$$P = \frac{\text{number of outages}}{n}$$
If n = 0, the probability is defined to be 0.0. The output should be a floating-point number with six decimal places.
inputFormat
The input is given from standard input (stdin) and has the following format:
- The first line contains an integer n, the number of minutes in the history.
- The second line contains n space-separated integers (each either 0 or 1) representing the outage history.
outputFormat
Output a single floating-point number to standard output (stdout) with exactly six decimal places which represents the probability that the next minute will be an outage.
## sample5
1 1 1 1 1
1.000000
</p>