HDU 4350 Card【规律】
来源:互联网 发布:javascript 设置class 编辑:程序博客网 时间:2024/05/17 07:57
Card
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1509 Accepted Submission(s): 843
Problem Description
Bearchild is playing a card game with himself. But first of all, he needs to shuffle the cards. His strategy is very simple: After putting all the cards into a single stack,
he takes out some cards in the middle, from the L-th to the R-th when counting from top to bottom, inclusive, and puts them on the top. He repeats this action again
and again for N times, and then he regards his cards as shuffled.
Given L,R and N, and the initial card stack, can you tell us what will the card stack be like after getting shuffled?
he takes out some cards in the middle, from the L-th to the R-th when counting from top to bottom, inclusive, and puts them on the top. He repeats this action again
and again for N times, and then he regards his cards as shuffled.
Given L,R and N, and the initial card stack, can you tell us what will the card stack be like after getting shuffled?
Input
First line contains an integer T(1 <= T <= 1000), which is the test cases.
For each test case, first line contains 52 numbers(all numbers are distinct and between 1 and 52), which is the card number of the stack, from top to bottom.
Then comes three numbers, they are N, L and R as described. (0<=N<=109, 1<=L<=R<=52)
For each test case, first line contains 52 numbers(all numbers are distinct and between 1 and 52), which is the card number of the stack, from top to bottom.
Then comes three numbers, they are N, L and R as described. (0<=N<=109, 1<=L<=R<=52)
Output
For each test case, output "Case #X:", X is the test number, followed by 52 numbers, which is the card number from the top to bottom.Note that you should output one and only
one blank before every number.
one blank before every number.
Sample Input
113 2 10 50 1 28 37 32 30 46 19 47 33 41 24 52 27 42 49 18 9 48 23 35 31 8 7 12 6 5 3 22 43 36 51 40 26 4 44 17 39 38 15 14 25 16 29 20 21 45 11 34902908328 38 50
Sample Output
Case #1: 26 4 44 17 39 38 15 14 25 16 29 20 21 45 13 2 10 50 1 28 37 32 30 46 19 47 33 41 24 52 27 42 49 18 9 48 23 35 31 8 7 12 6 5 3 22 43 36 51 40 11 34
Author
elfness@UESTC_Oblivion
Source
2012 Multi-University Training Contest 6
#include<cstdio>#include<math.h>#include<cstring>#include<climits>#include<string>#include<queue>#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<climits>#include<string>#include<queue>#include<stack>#include<set>#include<map>#include<algorithm>using namespace std;#define rep(i,j,k)for(i=j;i<k;i++)#define per(i,j,k)for(i=j;i>k;i--)#define MS(x,y)memset(x,y,sizeof(x))#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define ll long long#define abs(x) (x>0?x:-x)const int INF=0x7ffffff;int a[100],aa[100];int i,j,k,n,m;int N,L,R;int main(){ int T; scanf("%d",&T); int cas=0; while(T--){ cas++; for(i=1;i<=52;i++) scanf("%d",&a[i]); scanf("%d%d%d",&N,&L,&R); N%=R; while(N--){ for(i=1;i<=R;i++) aa[i]=a[i]; j=R; for(i=L-1;i>=1;i--){ a[j--]=aa[i]; } i=R; for(;j>=1;) a[j--]=aa[i--]; } printf("Case #%d:",cas); for(i=1;i<=52;i++) printf(" %d",a[i]); printf("\n"); } return 0;}
0 0
- HDU 4350 Card【规律】
- hdu 4350 Card 规律题 多校联合赛事
- hdu 4350 Card 模拟
- HDU 4350 card
- HDU 4350 - Card
- hdu 4350 Card
- HDU 4350 Card(数学)
- hdu 4350 card
- HDU 4350 Card
- hdu 6205 card card card
- HDU 6205:card card card
- HDU 6205 card card card
- hdu 6205 card card card
- card card card HDU-6205
- HDU 6205 card card card
- HDU 4350 Card 模拟题
- [循环节一水] hdu 4350 card
- HDU 4350 Card 模拟题
- bzoj3939 【USACO 2015 FEB GOLD 】cow hopscotch
- Open Source for the Operations Research Community
- 167. Two Sum II - Input array is sorted [LeetCode]
- 算法提高 8皇后·改
- 运维自动化实践笔记
- HDU 4350 Card【规律】
- JuliaOpt Optimization packages for the Julia language
- 赞!VC++编程创建远程线程式调用CALL_VirtualAllocEx_WriteProcessMemory_CreateRemoteThread_WaitForSingleObject
- 为LWIP移植DM9000驱动
- mysql小记
- spring framework体系结构及内部各模块jar之间的maven依赖关系
- wikioi1052 地鼠游戏
- Warning: Link to vtkInteractionStyle for default style selection的解决办法
- wei.getA()