Throwing cards away I UVA - 10935
2017-04-11 15:55
639 查看
问题类型:STL-queue应用。
03pie’s solution for [UVA-10935]
问题链接
03pie’s solution for [UVA-10935]
问题链接
#include<iostream> #include<queue> using namespace std; const int maxn=50; int main(){ //freopen("F://inp.txt","r",stdin); int n; while(cin>>n&&n){ queue<int> cards; for(int i=0;i<n;i++){ cards.push(i+1); } int len=cards.size(); cout<<"Discarded cards:"; if(len>1){ while(--len){ cout<<" "<<cards.front();//输出队首元素 if(len>1) cout<<","; cards.pop();//队首出队 cards.push(cards.front());//将新队首元素放在队尾 cards.pop();//队首出队 } } // else cout<<cards.front(); cout<<"\nRemaining card: "<<cards.front()<<endl; } return 0; }
相关文章推荐
- UVa 10935 - Throwing cards away I
- UVA 10935 Throwing cards away I 【数据结构】【模拟】
- UVa 10935 - Throwing cards away I
- UVa10935 - Throwing cards away I
- UVA 10935 Throwing Cards Away I 卡片游戏
- UVa 10935 Throwing cards away 1
- UVA 10935 - Throwing cards away I
- UVa10935-Throwing cards away I-卡片游戏-队列的运用
- UVA10935 - Throwing cards away I
- UVa 10935 - Throwing cards away I
- UVA 10935 - Throwing cards away I
- UVa 10935 - Throwing cards away I
- UVa---------10935(Throwing cards away I)
- Uva 10935 Throwing cards away I
- UVa 10935 Throwing cards away I【队列】
- UVA_10935: Throwing cards away I
- UVa 10935 - Throwing cards away I STL
- uva 10935 throwing cards away <queue>
- UVa 10935 - Throwing cards away I(模拟)
- Throwing cards away I 卡牌游戏 UVA 10935