#C13737. Filter Numbers and Compute Average

    ID: 43308 Type: Default 1000ms 256MiB

Filter Numbers and Compute Average

Filter Numbers and Compute Average

You are given a list of integers and a threshold value \(T\). Your task is to filter the list by retaining only those numbers that are greater than \(T\) and then compute the arithmetic mean of the filtered numbers. The arithmetic mean is given by the formula:

\(\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i\)

where \(n\) is the number of filtered elements and \(x_i\) represents each element. If no number in the list is greater than the threshold, the average is defined as 0.0.

inputFormat

The input is given via standard input (stdin) and consists of three lines. The first line contains an integer (N) representing the number of elements in the list. The second line contains (N) space-separated integers. The third line contains the threshold integer (T).

outputFormat

The output should be printed to standard output (stdout) in two lines. The first line contains the filtered list of integers separated by spaces. If no number is greater than the threshold, print an empty line. The second line contains the average of the filtered numbers as a floating point number rounded to one decimal place.## sample

5
10 20 30 40 50
25
30 40 50

40.0

</p>