cswork / OA打开练习工作台

eBayOA #1

Zigzag Reorder

估计简单可在线判题

考点(AI 标注)双指针滑窗原地数组

Output the first element of the original array, then the last, then the second, then the second to last, alternately taking from both ends until all elements are used.

输入格式

n (original problem: 5≤n≤1000), followed by n integers (site supplement: −10⁹..10⁹).

输出格式

Output the n reordered numbers.

样例 1

输入:

7
1 6 9 4 3 7 8

输出:

1 8 6 7 9 3 4

样例 2

输入:

5
1 1 2 2 3

输出:

1 3 1 2 2

样例 3

输入:

5
9 -1 0 8 7

输出:

9 7 -1 8 0