Simple question.
#include <cstdio>#include<cstring>#include<cmath>#include<vector>#include<map>#include<queue>#include<stack>#include<string>#include<algorithm>using namespacestd;structx{CharC; intnum;} s[ -];intans[ -],p[ -],tmp[ -];intN;voidinit () { for(intI=1; i<= -; i++) s[i].c='S', s[i].num=i; for(intI= -; i<= -; i++) s[i].c='H', s[i].num=i- -; for(intI= -; i<= the; i++) s[i].c='C', s[i].num=i- -; for(intI= +; i<= the; i++) s[i].c='D', s[i].num=i- the; s[ -].c='J'; s[ -].num=1; s[ Wu].c='J'; s[ Wu].num=2;}intMain () {init (); for(intI=1; i<= Wu; i++) ans[i]=i; intK scanf"%d",&k); for(intI=1; i<= Wu; i++) scanf ("%d",&P[i]); for(intI=1; i<=k;i++) { for(intj=1; j<= Wu; j + +) tmp[p[j]]=Ans[j]; for(intj=1; j<= Wu; j + +) ans[j]=Tmp[j]; } for(intI=1; i<= Wu; i++) {printf ("%c%d", S[ans[i]].c,s[ans[i]].num); if(i< Wu) printf (" "); Elseprintf"\ n"); } return 0;}
PAT (Advanced level) 1042. Shuffling Machine ()