当前位置:网站首页>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
边栏推荐
猜你喜欢
3D游戏建模教程:游戏角色制作——赏金猎人,超逼真
Smobiler的复杂控件的由来与创造
在Unity URP中实现Forward+
Performance optimization | CPU power management from the perspective of ping delay
16. Learn Lua file I/O together
卡通渲染的历史
3D角色建模师和3D角色动画师哪个更有前景?哪个更适合小白入门?
Open Office XML 格式中的 Style 设计原理
Learn about layered architecture & SOA architecture together
Shell脚本三剑客(grep、sed、awk)
随机推荐
Dandelion R300A 4G router, remote monitoring PLC tutorial
用工具实现 Mock API 的整个流程
干货技巧|如何用3DsMax制作笔记本电脑
feign的性能优化、Feign的使用-最佳优化两种方案
synApps -- Autosave
2022年美术生就业前景解析
Redis之SDS数据结构
TensorFlow学习记录(七):生成对抗网络
el-tree设置单选,点击完成后收起
量子力学奇妙之旅-铁磁性来由/双态系统
SUSECON 北京议程上新丨8月16日相聚望京凯悦
数据库学习之表的操作
在Unity URP中实现Forward+
uniapp parent component uses prop to pass asynchronous data to child components
智驾科技完成C1轮融资,此前2轮已融4.5亿元
行政区划代码(道路要素)
Azure Neural TTS 持续上新,助力企业开拓小语种市场
How to add F4 Value Help trial version to the input parameters of the report in the ABAP report
5 IPOs, Internet home improvement is not as simple as Tubatu thinks
Fortinet new cloud native protection products launched amazon cloud platform of science and technology