标签:name its 开始 代码 accept 容器 测试 顺序 style
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 18547 Accepted Submission(s): 7903
#include <bits/stdc++.h> using namespace std; int main() { int t,n; cin>>t; while(t--){ cin>>n; int k = 2; list<int>mylist; list<int>::iterator it; for(int i = 1;i <= n; i++) mylist.push_back(i); while(mylist.size()>3){ int num = 1; for(it = mylist.begin(); it != mylist.end();){ if(num++ % k == 0) it = mylist.erase(it); else it++; } k==2?k=3:k=2; } for(it = mylist.begin();it != mylist.end();it++){ if(it != mylist.begin()) cout<<" "; cout<<*it; } cout<<endl; } return 0; }
标签:name its 开始 代码 accept 容器 测试 顺序 style
原文地址:https://www.cnblogs.com/jingshixin/p/12241791.html