← 返回 citadel 的题目列表Square and Reverse a List
类型:online_judge
Problem
Implement square_and_reverse(nums): given a list of integers, return a new list whose order is the reverse of the input and whose elements are squared.
Do not modify the input list.
Input Format
Standard input contains:
First line: integer n
Second line: n space-separated integers; it may be empty when n = 0
Output Format
Print the resulting values separated by spaces.
Constraints
0 <= n <= 200000
-10^9 <= nums[i] <= 10^9
Example
Input:
3
1 2 3
Output:
9 4 1
Example
Input
0
Output