#K44957. Movie Ratings Evaluation

    ID: 27646 Type: Default 1000ms 256MiB

Movie Ratings Evaluation

Movie Ratings Evaluation

In this problem, you are given ratings for multiple movies across several test cases. Each test case begins with an integer (n) which represents the number of ratings for a movie, followed by (n) integers representing the ratings. The input terminates when (n = 0) is encountered. For each test case, you need to calculate the average rating (\bar{x} = \frac{\sum_{i=1}^{n} rating_i}{n}) and then determine the rating category based on the following criteria:

  • If (\bar{x} \geq 4.5), the category is Excellent.
  • If (3.5 \leq \bar{x} < 4.5), the category is Good.
  • If (2.5 \leq \bar{x} < 3.5), the category is Fair.
  • Otherwise, the category is Poor.

Output the average rating (rounded to one decimal place) followed by its corresponding category for each movie. The output for each test case should be printed on a new line.

inputFormat

The input is read from standard input (stdin). It contains several test cases. Each test case starts with an integer (n) ((n > 0)) on a separate line, indicating the number of ratings for a movie. This is followed by (n) lines each containing an integer rating (1 to 5). The input terminates with a line containing a single zero (0).

outputFormat

For each test case, output a single line containing the average rating of the movie (rounded to one decimal place) followed by a space and then the corresponding rating category. The output should be written to standard output (stdout).## sample

3
5
4
5
4
1
5
5
5
2
1
2
0
4.7 Excellent

4.0 Good 1.5 Poor

</p>