文章
84
粉丝
408
获赞
33
访问
877.1k
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int m;
cin >> m;
while (m--) {
int N, i;
cin >> N;
vector<int> vint;
for (i = 1; i <= N; i++)
vint.push_back(i);
vector<int>::iterator itr = vint.begin();
i = 0;
while (vint.size() > 1) {
if ((i+1)%3 == 0) {
cout << *itr << " ";
vint.erase(itr);
itr--;
}
i++;
itr++;
if (itr == vint.end()) {
itr = vint.begin();
}
}
cout << *(vint.begin()) << endl;
vint.clear();
}
}
登录后发布评论
暂无评论,来抢沙发