#K15201. List Transformation Challenge

    ID: 24304 Type: Default 1000ms 256MiB

List Transformation Challenge

List Transformation Challenge

You are given a list of integers. Your task is to perform the following operations in order:

  1. Reverse the list.
  2. Replace each element with its square (i.e., compute x2x^2 for each element xx).
  3. Remove all elements that are even (i.e., keep only those elements for which xmod20x \mod 2 \neq 0).

Finally, print the resulting list as a space-separated string. If the list becomes empty after the transformation, output an empty line.

inputFormat

The first line contains an integer nn, representing the number of elements in the list. The second line contains nn space-separated integers.

outputFormat

Output a single line with the transformed list's integers separated by a single space. If no integers remain after processing, output an empty line.## sample

5
1 2 3 4 5
25 9 1