#K43622. Calculate Average Scores

    ID: 27351 Type: Default 1000ms 256MiB

Calculate Average Scores

Calculate Average Scores

You are given a list of student scores and several queries. Each query specifies a subarray of scores by providing two integers \(l\) and \(r\), representing the starting and ending indices (1-indexed). Your task is to calculate the average score for each subarray. The average must be rounded to exactly two decimal places.

Use the formula for average: $$\text{Average} = \frac{S}{n}$$, where \(S\) is the sum of the scores in the subarray and \(n\) is the number of scores in that subarray.

inputFormat

The input begins with a line containing two integers \(n\) and \(q\), where \(n\) is the number of student scores and \(q\) is the number of queries.

The second line contains \(n\) space-separated integers representing the student scores.

The following \(q\) lines each contain two integers \(l\) and \(r\) (1-indexed), representing the start and end indices of the subarray to consider.

outputFormat

For each query, output the average score of the corresponding subarray, rounded to exactly two decimal places. Each result should be printed on a new line.

## sample
5 3
50 90 80 60 70
1 3
2 5
1 5
73.33

75.00 70.00

</p>