Codeforces Round 1089 (Div. 2)
A
A Simple Sequence
Codeforces
800
原题
←B →
翻译中…

You are given an integer $n$. You need to construct a permutation$^{\text{∗}}$ $a_1, a_2, \ldots, a_n$ using integers from $1$ to $n$ such that the following condition is satisfied:

翻译中…

$$ a_1 \bmod a_2 \ge a_2 \bmod a_3 \geq \ldots \ge a_{n-1} \bmod a_{n}, $$ where $u$ mod $v$ denotes the remainder of dividing $u$ by $v$.

翻译中…

If multiple valid permutations exist, you may output any of them.

翻译中…

It can be shown that a valid permutation always exists for every $n \ge 2$.

翻译中…

$^{\text{∗}}$A permutation of length $n$ is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5,4]$ is a permutation, but $[1,2,2]$ is not a permutation ($2$ appears twice in the array), and $[1,3,4]$ is also not a permutation ($n=3$ but there is $4$ in the array).

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$). The description of the test cases follows.

翻译中…

The first line of each test case contains a single integer $n$ ($2 \le n \le 100$).

翻译中…

Output

翻译中…

For each test case, output on a single line $n$ space-separated integers $a_1, a_2, \ldots a_n$.

翻译中…

If multiple valid permutations exist, you may output any of them.

翻译中…

Note

翻译中…

In the second test case, $2 \bmod 3 \ge 3 \bmod 1$, so the permutation $[2, 3, 1]$ is valid.

翻译中…

In the third test case, $2 \bmod 4 \ge 4 \bmod 3 \ge 3 \bmod 1$, so the permutation $[2, 4, 3, 1]$ is valid.

翻译中…

样例

Input #1
4
2
3
4
5
Output #1
2 1
2 3 1
2 4 3 1
3 5 4 2 1
InputCopy OutputCopy
题目信息
题号
2210A
时间限制
1 s
内存限制
256 MB
标签
构造
动态规划
贪心
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。