码迷,mamicode.com
首页 > 其他好文 > 详细

卡片游戏(队列)

时间:2014-07-22 22:34:33      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:blog   os   io   2014   for   re   

#include<iostream>
#include<queue>
using namespace std;
queue<int>q;
int main()
{
     int n;
	 cin>>n;
	 for(int i=1;i<=n;i++)
		 q.push(i);
	 while(!q.empty())
	 {
		 cout<<q.front()<<' ';
		 q.pop();
		 if(!q.empty())
		 {
		 q.push(q.front());
		 q.pop();
		 }
	 }
	 
	return 0;
}

卡片游戏(队列),布布扣,bubuko.com

卡片游戏(队列)

标签:blog   os   io   2014   for   re   

原文地址:http://blog.csdn.net/rememberautumn/article/details/38045133

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!