PAT A1042
作者:互联网
#include <cstdio> const int N = 54; char Color[5] = {'S', 'H', 'C', 'D', 'J'}; int start[N+1], trans[N+1], end[N+1]; int main() { int n; scanf("%d",&n); for(int i = 1; i <= N; i++){ start[i] = i; } for(int i = 1; i <= N; i++){ scanf("%d",&trans[i]); } for(int step = 0; step < n; step++){ for(int i = 1; i <= N; i++){ end[trans[i]] = start[i]; } for(int i = 1; i <= N; i++){ start[i] = end[i]; } } for(int i = 1; i <=N; i++){ if(i != 1) printf(" "); start[i]--; printf("%c%d",Color[start[i]/13],start[i]%13+1); } return 0; } //36 52 37 38 3 39 40 53 54 41 11 12 13 42 43 44 2 4 23 24 25 26 27 6 7 8 48 49 50 51 9 10 14 15 16 5 17 18 19 1 20 21 22 28 29 30 31 32 33 34 35 45 46 47
标签:main,const,A1042,int,start,PAT,trans 来源: https://www.cnblogs.com/zjsaipplp/p/10380903.html