#include <iostream>
#define LEN 15
using namespace std;
int main()
{
int k;
cin >> k;
while(k--)
{
int n;
int a[LEN];
int front;
int rear;
cin >> n;
front = rear = 0;
for(int i = n; i >= 1; i--)
{
a[front] = i;
front = ( (front + LEN) - 1 ) % LEN;
for(int j = 0; j < i; j++)
{
a[front] = a[rear];
front = ( (front + LEN) - 1 ) % LEN;
rear = ( (rear + LEN) - 1 ) % LEN;
}
}
for(int i = 1; i <= n; i++)
{
if( i == 1 )
cout << a[ (front + i + LEN) % LEN ];
else
cout << " " << a[ (front + i + LEN) % LEN ];
}
cout << endl;
}
}
南阳理工OJ_题目714 Card Trick
最新推荐文章于 2019-04-04 10:46:36 发布