#C14774. Filter and Sort Positive Numbers

    ID: 44460 Type: Default 1000ms 256MiB

Filter and Sort Positive Numbers

Filter and Sort Positive Numbers

Given a sequence of integers, your task is to filter out all non-positive numbers (i.e. numbers less than or equal to zero) and then sort the remaining positive numbers in descending order.

The input is provided via standard input (stdin) and the output must be written to standard output (stdout). The first line of input contains an integer n which represents the number of integers. The second line contains n space-separated integers. If there are no positive numbers, output an empty line.

Please note that any formulas or mathematical notation needed should be provided in LaTeX format. For example, to express the sorting order, you could indicate that if \(a > b\) then \(a\) comes before \(b\) in the sorted order.

inputFormat

The first line contains an integer \(n\) denoting the number of elements in the list. The second line contains \(n\) space-separated integers.

Input Format:

n
num1 num2 num3 ... numn

outputFormat

Output the positive integers from the list sorted in descending order. The integers should be printed on a single line separated by a single space. If there are no positive integers, print an empty line.

Output Format:

result1 result2 ... resultk
## sample
6
3 -1 0 5 9 -2
9 5 3

</p>