当前位置:网站首页>nyoj714 Card Trick (The 6th Henan Province Programming Contest)
nyoj714 Card Trick (The 6th Henan Province Programming Contest)
2022-08-08 19:07:00 【51CTO】
Card Trick
1000 ms | 内存限制: 65535
3
The magician shuffles a small pack of cards, holds it face down and performs the following procedure:
- The top card is moved to the bottom of the pack. The new top card is dealt face up onto the table. It is the Ace of Spades.
- Two cards are moved one at a time from the top to the bottom. The next card is dealt face up onto the table. It is the Two of Spades.
- Three cards are moved one at a time…
- This goes on until thenth and last card turns out to be thenof Spades.
This impressive trick works if the magician knows how to arrange the cards beforehand (and knows how to give a false shuffle). Your program has to determine the initial order of the cards for a given number of cards, 1 ≤ n ≤ 13.
On the first line of the input is a single positive integer k, telling the number of test cases to follow. 1 ≤ k ≤ 10 Each case consists of one line containing the integer n. 1 ≤ n ≤ 13 输出 For each test case, output a line with the correct permutation of the values 1 to n, space separated. The first number showing the top card of the pack, etc… 样例输入
样例输出
来源 第六届河南省程序设计大赛
上传者
ACM_赵铭浩
题意:给你n张牌,分别是1-n
First put on top1Zhang put it at the bottom,Reveal the current top card 使其为1
The second time put on top2Zhang put it at the bottom,Reveal the current top card 使其为2
The third time put on top3Zhang put it at the bottom,Reveal the current top card 使其为3
..............
Just simulate the process Of course if you are more critical of time 由于最多只有13张牌 The result can be stored in an array
边栏推荐
猜你喜欢
随机推荐
Oracle--表
数字化工厂建设的内容主要有哪三个方面
我们想更换RDS数据库,从sqlserver 2016 web升级到 2017企业集群版,有专家咨询
OpenSSH生成的私钥如何在putty中使用?
Fortinet全新云原生保护产品上线亚马逊云科技平台
PX4模块设计之十九:Replay模块
PG's huge page
阿里云数据库PolarDB开源人才培养计划发布!万元好礼等你来拿!
【761. Special binary sequence】
小白转行做3D游戏建模,有没有前途?
Why do programmers only close monitor from none computer after work?Look at the answer ~ each big web site
FTP服务初探
The origin and creation of Smobiler's complex controls
面了个腾讯30k+出来的,他让我见识到什么叫精通MySQL调优
“非洲之王”传音答复投资者提问:手机产品暂无计划进入中国
Redhat 7 Maria DB安装与配置
架构设计基本原则
Laravel 5.8 Notes
21天学习挑战赛——机器学习02
vue项目打包后的网页缓存问题