#K55967. Average of Top K Scores

    ID: 30093 Type: Default 1000ms 256MiB

Average of Top K Scores

Average of Top K Scores

You are given a list of student scores and an integer k. Your task is to compute the average of the top k scores. If k is greater than the number of scores available, compute the average of all scores.

The average is calculated as follows:

\(\text{average} = \frac{\sum_{i=1}^{\min(k,n)} s_i}{\min(k,n)}\)

where \(n\) is the total number of scores and the scores \(s_i\) are sorted in descending order.

Print the result rounded to two decimal places.

inputFormat

The input consists of two lines:

  1. The first line contains a sequence of integers separated by spaces representing the student scores.
  2. The second line contains an integer k.

outputFormat

Output a single line containing the average of the top k scores rounded to two decimal places.

## sample
70 80 90 100 85
3
91.67