#C12451. Reverse and Double the List Elements
Reverse and Double the List Elements
Reverse and Double the List Elements
You are given a list of integers. Your task is to reverse the order of the list and then double each element. In other words, if the input list is ( [a_1, a_2, \dots, a_n] ), the expected output is ( [2a_n, 2a_{n-1}, \dots, 2a_1] ). This problem tests your ability to manipulate array data and perform basic arithmetic operations.
inputFormat
The input is given via standard input (stdin) and consists of two lines. The first line contains a single integer ( n ) which indicates the number of elements in the list. The second line contains ( n ) space-separated integers.
outputFormat
Output the reversed list with each element doubled. The output should be a single line of space-separated integers. If the list is empty, output nothing.## sample
4
1 2 3 4
8 6 4 2