PAT 1042

#include <stdio.h>#include <string.h>int main(){  //freopen("in.txt","r",stdin);

  int k;
  scanf("%d",&k);  char cards[54][4] = {"S1", "S2", "S3", "S4","S5","S6", "S7", "S8", "S9","S10", "S11", "S12","S13",  "H1", "H2", "H3", "H4","H5","H6", "H7", "H8", "H9","H10", "H11", "H12","H13",  "C1", "C2", "C3", "C4","C5","C6", "C7", "C8", "C9","C10", "C11", "C12","C13",  "D1", "D2", "D3", "D4","D5","D6", "D7", "D8", "D9","D10", "D11", "D12","D13",  "J1","J2"
  };  char shuff[54][4];
  memset(shuff,0,sizeof(shuff));  
  int i;  int order[54];  for(i=0; i<54; i++){
      scanf("%d", &order[i]);
  }  while(0 < k--){    for(i=0; i<54; i++){      int pos = order[i];
      pos--;
      strcpy(shuff[pos],cards[i]);
  
    }    //按照洗牌后的顺序再洗
    for(i=0; i<54; i++){
      strcpy(cards[i],shuff[i]);
    }
  }

  printf("%s", shuff[0]);  for(i=1; i<54; i++){
      printf(" %s", shuff[i]);
  }  return 0;
}


你可能感兴趣的:(PAT 1042)