最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1462A - Favorite Sequence

2023-07-26 13:04 作者:您是打尖兒還是住店呢  | 我要投稿

Polycarp has a favorite sequence a[1…n] consisting of n integers. He wrote it out on the whiteboard as follows:

he wrote the number a1 to the left side (at the beginning of the whiteboard);he wrote the number a2 to the right side (at the end of the whiteboard);then as far to the left as possible (but to the right from a1), he wrote the number a3;

then as far to the right as possible (but to the left from a2), he wrote the number a4;

Polycarp continued to act as well, until he wrote out the entire sequence on the whiteboard.

The beginning of the result looks like this (of course, if n≥4).

For example, if n=7 and a=[3,1,4,1,5,9,2], then Polycarp will write a sequence on the whiteboard [3,4,5,2,9,1,1].

You saw the sequence written on the whiteboard and now you want to restore Polycarp's favorite sequence.


Input

The first line contains a single positive integer t (1≤t≤300) — the number of test cases in the test. Then t test cases follow.


The first line of each test case contains an integer n (1≤n≤300) — the length of the sequence written on the whiteboard.


The next line contains n integers b1,b2,…,bn (1≤bi≤109) — the sequence written on the whiteboard.


Output

Output t

?answers to the test cases. Each answer — is a sequence a that Polycarp wrote out on the whiteboard.

---------------------------------------------------

Polycarp 最喜歡的序列 a[1…n] 由 n 個整數(shù)組成。 他在白板上寫下了如下內(nèi)容:

他把數(shù)字a1寫在左邊(在白板的開頭);他把數(shù)字a2寫在右邊(在白板的結(jié)尾);然后盡可能地向左寫(但從右邊寫) a1),他寫下了數(shù)字a3;

然后盡可能地向右(但在a2的左側(cè)),他寫下了數(shù)字a4;

波利卡普也繼續(xù)表演,直到他在白板上寫下了整個序列。

結(jié)果的開頭看起來像這樣(當(dāng)然,如果n≥4)。

例如,如果n=7且a=[3,1,4,1,5,9,2],則Polycarp將在白板上寫下一個序列[3,4,5,2,9,1,1] 。

您看到了寫在白板上的序列,現(xiàn)在您想要恢復(fù)波利卡普最喜歡的序列。


輸入

第一行包含一個正整數(shù) t (1≤t≤300) — 測試中測試用例的數(shù)量。 然后是測試用例。


每個測試用例的第一行包含一個整數(shù)n(1≤n≤300)——白板上寫的序列的長度。


下一行包含 n 個整數(shù) b1,b2,…,bn (1≤bi≤109) — 寫在白板上的序列。


輸出

輸出功率

? 測試用例的答案。 每個答案都是波利卡普在白板上寫下的一個序列 a。

--------------------------------------------------------------------------

利用雙指針去處理即可;


CF 1462A - Favorite Sequence的評論 (共 條)

分享到微博請遵守國家法律
钟祥市| 巴楚县| 古浪县| 镇康县| 久治县| 祁门县| 翁源县| 乌审旗| 岳西县| 新竹县| 玉树县| 青河县| 海安县| 九龙坡区| 绥化市| 永康市| 天门市| 深州市| 西和县| 建昌县| 阿图什市| 奉化市| 石嘴山市| 紫金县| 闵行区| 莱西市| 汉阴县| 合肥市| 兴化市| 正安县| 义马市| 衡东县| 海晏县| 威信县| 临桂县| 济宁市| 岗巴县| 西林县| 紫阳县| 监利县| 大港区|