当前位置:网站首页>nyoj714 Card Trick(第六届河南省程序设计大赛)
nyoj714 Card Trick(第六届河南省程序设计大赛)
2022-08-08 18:33: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
第一次把最上面1张放到最下面,亮出当前最上面的牌 使其为1
第二次把最上面2张放到最下面,亮出当前最上面的牌 使其为2
第三次把最上面3张放到最下面,亮出当前最上面的牌 使其为3
..............
模拟一下过程就好了 当然如果你对时间更苛刻 由于最多只有13张牌 可以把结果存在一个数组
边栏推荐
- HCIP第十三天作业——综合实验
- 【wpf】Bingding的方向和触发的时机
- 几何g6将搭载harmonyos系统,产品竞争力全面升级
- oracle视图v$active_session_history,dba_hist_active_session_history如何记录IP地址
- Transsion Holdings: At present, there is no clear plan for the company's mobile phone products to enter the Chinese market
- 关于求最小公倍数的三种常用方法
- 黑磷量子点/无机荧光量子点/石墨烯量子点水凝胶/量子点/纳米水凝胶荧光探针的研究制备
- 请问shake数据库中mongoshake同步过程中,src_mongo挂了,同步服务不会退出吗?
- feign的性能优化、Feign的使用-最佳优化两种方案
- This error is reported when the shake database is started. Is there a problem with the configuration?
猜你喜欢
随机推荐
uniapp parent component uses prop to pass asynchronous data to child components
APICloud AVM 封装日期和时间选择组件
openEuler资源利用率提升之道02:典型应用下的效果
mv-lcd初始化
Dandelion R300A 4G router, remote monitoring PLC tutorial
数据压缩和归档(二)、zipfile
PX4模块设计之十八:Logger模块
Laravel 队列消费实例和定时任务添加任务消费
浅谈C语言简单实现二分查找
2021年9月电子学会图形化一级编程题解析含答案:无奈的Jaime
codeforces 231A.Team
Rethinking HTAP database caused by rereading GPDB and TiDB papers
量子力学奇妙之旅-铁磁性来由/双态系统
响应式pbootcms模板电脑维修类网站
MogDB学习笔记-从0开始
面经刺客 | 关于——字节飞书基础架构产品 日常实习面经
达梦数据库 DmAPservice服务,启停影响 DMSERVER库服务吗?
Build DG will increase the amount of lead to archive log problem
Performance optimization | CPU power management from the perspective of ping delay
21天学习挑战赛——机器学习01