![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 //运用STL,使代码更加标准化,可读性强 2 3 1 #include <cstdio> 4 2 #include <queue> 5 3 using namespace std; 6 4 queue<int> q; 7 5 int main() 8 6 { 9 7 int n; 10 8 scanf("%d",&n); 11 9 for(int i=0;i<n;i++) 12 10 q.push(i+1); 13 11 while(!q.empty()) 14 12 { 15 13 printf("%d ",q.front()); 16 14 q.pop(); 17 15 q.push(q.front()); 18 16 q.pop(); 19 17 } 20 18 printf("\n"); 21 19 return 0; 22 20 }