UVa 10935 - Throwing cards away I
2014-12-09 17:04
561 查看
队列的简单应用,PE了两次。
#include<iostream> #include<queue> using namespace std; int main() { int n; while(cin >> n&& n) { bool sign = false; queue<int> q; for(int i = 1; i <= n; i++) q.push(i); cout << "Discarded cards:"; while(q.size() != 1) { sign ? cout << ", " : cout << " "; sign = true; cout << q.front(); q.pop(); if(q.size() == 1) break; q.push(q.front()); q.pop(); } cout << endl << "Remaining card: " << q.front() << endl; } return 0; }
相关文章推荐
- Throwing cards away I UVA - 10935
- UVa 10935 - Throwing cards away I STL
- UVa 10935 - Throwing cards away I(模拟)
- UVA_10935: Throwing cards away I
- uva 10935 throwing cards away <queue>
- Uva 10935 Throwing cards away I
- Throwing cards away I 卡牌游戏 UVA 10935
- UVa 10935 - Throwing cards away I
- 卡片游戏(Throwing cards away I,UVa 10935)
- Uva 10935 Throwing cards away I
- Uva 10935 Throwing cards away I
- UVA10935 Throwing cards away I【模拟+queue+循环队列】
- UVa 10935 - 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
- Uva - 10935 - Throwing cards away I
- Uva 10935 Throwing cards away I
- Throwing cards away I UVA - 10935