Throwing cards away I uva1594】的更多相关文章

 Throwing cards away I Given is an ordered deck of  n  cards numbered 1 to n  with card 1 at the top and card  n  at the bottom. The following operation is performed as long as there are at least two cards in the deck: Throw away the top card and m…
Throwing cards away I   Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck:  Throw away the top card and move t…
原题 Throwing cards away I   Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck:   Throw away the top card and mo…
题目: Problem B: Throwing cards away I Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck: Throw away the top car…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa10935 - Throwing cards away I #include<iostream> #include<queue> int N; int main() { //freopen("in.txt", "r", stdin); while (scanf("%d", &N) !=…
D - Throwing cards away I Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck:   Throw away the top card and mov…
UVA10940 - Throwing cards away II(找规律) 题目链接 题目大意:桌上有n张牌,依照1-n的顺序从上到下,每次进行将第一张牌丢掉,然后把第二张放到这叠牌的最后.重复进行这种操作.直到仅仅剩下一张牌. 解题思路:仅仅能先暴力.将前面小点的n打印出来.看看有什么规律. 规律:f[2^k + mod] = 2*mod;(mod > 0); n = 1须要特判. 代码: #include <cstdio> #include <cstring> cons…
直接用STL里的queue模拟即可. #include <cstdio> #include <queue> using namespace std; ; int discarded[maxn], cnt; int main() { int n; && n) { cnt = ; queue<int> Q; ; i <= n; i++) Q.push(i); ) { discarded[cnt++] = Q.front(); Q.pop(); int…
题意:给出 n张牌,从上往下编号依次为1到n,当牌的数目至少还剩下2张时,把第一张牌扔掉,然后把新的一张牌放在牌堆的最底部,问最后剩下的那一张牌是哪一张牌. 模拟队列的操作------- #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> #include<queue> using namespace st…
Given is an ordered deck of    n    cards numbered 1 to    n    with card 1 at the top and card    n    at the bottom. The following operation is performed as long as there are at least two cards in the deck: Throw away the top card and move the card…