#C4847. Employee Performance Average Score

    ID: 48430 Type: Default 1000ms 256MiB

Employee Performance Average Score

Employee Performance Average Score

You are given records of employee performance scores over several periods. Each record is provided in a single line containing an employee identification number, the number of performance periods, followed by the scores for each period. The processing rules are as follows:

  • If the number of periods is 1, the average score is the only score provided.
  • If the number of periods is 2, the average score is the arithmetic mean of the two scores.
  • If the number of periods is greater than 2, first sort the scores, remove the lowest and the highest score, and then calculate the average of the remaining scores. The average should be computed as \(\frac{\text{sum of scores after removing min and max}}{\text{periods} - 2}\).

The input is terminated by a line containing a single 0 which should not be processed.

For each employee record processed, output the employeeID followed by the average score rounded to one decimal place.

inputFormat

The input consists of multiple lines. Each line (except the terminating line) contains:

  1. An integer representing the employee identification number.
  2. An integer representing the number of performance periods.
  3. A sequence of integers representing the performance scores for each period.

The final line of input will be a single 0, which signifies the end of input.

outputFormat

For each processed record, output a line containing the employee identification number, a space, and the average score rounded to one decimal place.

## sample
102 1 75
0
102 75.0