1.题目介绍
2.考察点,难度
模拟现实类,字符串操作,难度易
3.解题代码
#include <iostream>
#include <string>
using namespace std;
int main(){
int N;
scanf("%d",&N);
int order[54];
int listone[54],listtwo[54]={0};
for(int i=0;i<54;i++){
scanf("%d",&order[i]);
listone[i]=i+1;
}
for(int i=0;i<N;i++){
if(i%2==0){
for(int j=0;j<54;j++){
listtwo[order[j]-1]=listone[j];
}
}
else{
for(int j=0;j<54;j++){
listone[order[j]-1]=listtwo[j];
}
}
}
string out;
if(N%2==0){
for(int i=0;i<54;i++){
int pos=(listone[i]-1)/13,abs=(listone[i]-1)%13;
switch(pos){
case 0: out="S";out.append(to_string(abs+1));break;
case 1: out="H";out.append(to_string(abs+1));break;
case 2: out="C";out.append(to_string(abs+1));break;
case 3: out="D";out.append(to_string(abs+1));break;
default: out="J";out.append(to_string(abs+1));
}
if(i==53){
cout<<out;
break;
}
cout<<out+" ";
}
}
else{
for(int i=0;i<54;i++){
int pos=(listtwo[i]-1)/13,abs=(listtwo[i]-1)%13;
switch(pos){
case 0: out="S";out.append(to_string(abs+1));break;
case 1: out="H";out.append(to_string(abs+1));break;
case 2: out="C";out.append(to_string(abs+1));break;
case 3: out="D";out.append(to_string(abs+1));break;
default: out="J";out.append(to_string(abs+1));
}
if(i==53){
cout<<out;
break;
}
cout<<out+" ";
}
}
return 0;
}