题目理解:
- 这道题似乎是简单构造题,我是打表打出来的。如下面所示:
...
0 1 2 0 1 第五层
2 0 1 2 第四层
1 2 0 第三层
0 1 第二层
2 第一层不难发现,第 层的第 个就是 。
AC 代码:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<(i+n)%3<<" ";
}
cout<<endl;
}
}