#K80892. Process Numbers: Even Squares and Odd Cubes

    ID: 35631 Type: Default 1000ms 256MiB

Process Numbers: Even Squares and Odd Cubes

Process Numbers: Even Squares and Odd Cubes

This problem requires you to process a list of integers. For each integer in the list, if it is even, you must square the integer; if it is odd, you must cube the integer. The order of the output must be the same as the order of the input.

Task: Read an integer n (the number of elements), followed by a line of n space-separated integers. Transform the list by squaring every even number and cubing every odd number, then output the resulting list as space-separated integers on a single line.

Note: Negative numbers should be processed similarly (for example, -2 is even so its square is 4, and -3 is odd so its cube is -27).

inputFormat

The input starts with an integer n which indicates the number of elements in the list. The second line contains n space-separated integers.

outputFormat

Output a single line of n space-separated integers after applying the transformation: square the even numbers and cube the odd numbers.## sample

4
1 2 3 4
1 4 27 16