DuolingoOA #1
Construct New Array
估计简单可在线判题
Build a new array by taking, in order, the leftmost element of the original array, then the rightmost, the second from the left, the second from the right, and so on.
输入格式
The first line contains n (1≤n≤100000), and the second line contains n integers (−10^9≤a[i]≤10^9).
输出格式
Output the n integers in construction order.
样例 1
输入:
5
0 4 3 2 1
输出:
0 1 4 2 3
样例 2
输入:
6
-5 4 0 3 2 2
输出:
-5 2 4 2 0 3
样例说明
Derive the linear scan/dynamic programming solution directly from the rules of the problem; the examples have been checked one by one against an independently built oracle.