#K56202. Maximum Average Quality Check Score

    ID: 30146 Type: Default 1000ms 256MiB

Maximum Average Quality Check Score

Maximum Average Quality Check Score

You are given a list of integer scores representing quality check scores. Your task is to find the maximum average score among all contiguous subarrays of scores.

More formally, given an array \(a_1, a_2, \ldots, a_n\), you need to compute

[ \max_{1 \le i \le j \le n} \frac{a_i+a_{i+1}+\cdots+a_j}{j-i+1}. ]

The answer should be printed with exactly one digit after the decimal point.

Note that there may be multiple test cases in a single input. Each test case begins with an integer n indicating the number of scores, followed by a line of n space-separated integers. The input terminates with a test case where n = 0, which should not be processed.

inputFormat

The input consists of multiple test cases. Each test case is described as follows:

  • The first line contains a single integer n (n > 0), the number of scores.
  • The second line contains n space-separated integers representing the scores.

The input ends with a line containing a single zero (0), which should not be processed.

outputFormat

For each test case, output a single line containing the maximum average score of any contiguous subarray, formatted to one decimal place.

## sample
6
-1 -2 3 4 -1 2
0
4.0