简单题
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define maxn 20
int f[maxn];
int vis[maxn];
int n;
int main()
{
//freopen("t.txt", "r", stdin);
int t;
scanf("%d", &t);
while (t--)
{
memset(vis, 0, sizeof(vis));
scanf("%d", &n);
int pos = 0;
for (int i = 1; i <= n; i++)
{
for (int j = 0; j < i; j++)
{
while (vis[pos % n])
pos++;
pos++;
}
while (vis[pos % n])
pos++;
pos %= n;
f[pos] = i;
vis[pos] = true;
}
printf("%d", f[0]);
for (int i = 1; i < n; i++)
printf(" %d", f[i]);
putchar('\n');
}
return 0;
}