#K786. Alternate Reverse Order
Alternate Reverse Order
Alternate Reverse Order
Given an array of integers, rearrange the array in an alternate reverse order. In other words, the program must output the last element first, then the first element, then the second last element, and then the second element, and so on.
For a sequence \(A\) of length \(n\), the new sequence \(R\) is constructed by selecting for each \(i\) (starting at \(0\)) the element \(A_{n-i}\) followed by \(A_{i+1}\), ensuring that if there is a middle element (in the case of odd \(n\)) it is output only once.
inputFormat
The first line contains a single integer \(n\) (\(n \geq 1\)), indicating the number of elements in the array. The second line contains \(n\) integers separated by spaces.
outputFormat
Output the rearranged array in a single line with the numbers separated by a single space.
## sample6
1 2 3 4 5 6
6 1 5 2 4 3