#C6305. Even Squares Filter
Even Squares Filter
Even Squares Filter
Given a list of integers, compute a new list composed of the square of each integer, but only include those squares which are even. Formally, for each integer \( x \) in the input, compute \( x^2 \) and include it in the output if \( x^2 \equiv 0 \pmod{2} \). Note that this condition is equivalent to \( x \) being even, but you should perform the check on the square value.
For example:
- Input: [1, 2, 3, 4, 5] → Output: [4, 16]
- Input: [-1, -2, -3, -4, -5] → Output: [4, 16]
- Input: [0, 3, 6, 9, 12] → Output: [0, 36, 144]
- Input: [11, 13, 17, 19] → Output: []
- Input: [2, -4, 6, -8, 10] → Output: [4, 16, 36, 64, 100]
inputFormat
The input is given via standard input (stdin) and has the following format:
- The first line contains a single integer \( n \) representing the number of integers in the list.
- The second line contains \( n \) space-separated integers.
outputFormat
Output the even squares as a sequence of space-separated integers on a single line to standard output (stdout). If there are no even squares, output an empty line.
## sample5
1 2 3 4 5
4 16