当前位置:网站首页>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张牌 可以把结果存在一个数组
边栏推荐
- 数据库学习之表的操作
- 阿里云数据库PolarDB开源人才培养计划发布!万元好礼等你来拿!
- Excuse me, during the mongoshake synchronization process in the shake database, src_mongo hangs up, will the synchronization service not exit?
- 量子力学奇妙之旅-铁磁性来由/双态系统
- MySQL:Update高并发下变慢的案例及其涉及的特性
- Task-Driven Super Resolution: Object Detection in Low-resolution Images
- 轻量全景查看器 pannellum初探
- 视图,索引
- We want to replace the RDS database and upgrade from sqlserver 2016 web to 2017 enterprise cluster version, with expert consultation
- 响应式pbootcms模板建筑装饰类网站
猜你喜欢
Research on ORACLE subqueries that lead to inability to push predicates
QT With OpenGL (Bloom) (Bloom)
HCIP第十三天作业——综合实验
一起了解分层架构&SOA架构
ABAP 报表中如何给报表的输入参数增添 F4 Value Help
重读GPDB 和 TiDB 论文引发的 HTAP 数据库再思考
Fortinet new cloud native protection products launched amazon cloud platform of science and technology
Lecture 4: Database Definition Language of DDL Type of SQL Statements
LeetCode:每日一题【第二周】
Laravel 5.8 Notes
随机推荐
数据库学习之表的操作
Flush can buy stock?Is it safe to buy stocks?
一起了解分层架构&SOA架构
荧光探针/近红外荧光/荧光纳米/水凝胶/纳米水凝胶pH荧光探针的研究
Dandelion R300A 4G router, remote monitoring PLC tutorial
16. Learn Lua file I/O together
在线支付,出款和收款
flask基础知识:
Fortinet全新云原生保护产品上线亚马逊云科技平台
Rethinking HTAP database caused by rereading GPDB and TiDB papers
全栈开发可能需要的环境及工具
性能优化|从ping延时看CPU电源管理
请问shake数据库中mongoshake同步过程中,src_mongo挂了,同步服务不会退出吗?
重读GPDB 和 TiDB 论文引发的 HTAP 数据库再思考
Laravel 5.8 Notes
堆排序(Heap Sort)实现
OpenInfra Days China 2022即将开启,与 openEuler 共话开源技术
达梦数据库 DmAPservice服务,启停影响 DMSERVER库服务吗?
什么是Shell?从小白到入门你只差一个它
微信小程序云开发 | 插件的微信小程序云开发