Permutation

TimeLimit:1000MS  MemoryLimit:262144KB
64-bit integer IO format:%I64d
Special Judge
未提交 | 登录后收藏
Problem Description
A permutation $p_1, p_2, ... , p_n$ of $1, 2, ..., n$ is called a lucky permutation if and only if $p_i \equiv 0 \pmod{|p_i - p_{i - 2}|} $ for $i = 3 ... n$.

Now you need to construct a lucky permutation with a given $n$.
Input
The first line is the number of test cases.

For each test case, one single line contains a positive integer $n(3 \leq n \leq 10^5)$.
Output
For each test case, output a single line with $n$ numbers $p_1 , p_2, ..., p_n$.

It is guaranteed that there exists at least one solution. And if there are different solutions, print any one of them.
SampleInput
1
6
SampleOutput
1 3 2 6 4 5
Submit
题目统计信息详细
总AC数4
通过人数4
尝试人数4
总提交量4
AC率100.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: