PAT 1042 水题
水
代码:
#include <bits/stdc++.h>
using namespace std;
string s = "SHCDJ";
int t;
int Shuffling[55];
vector<string> deck;
vector<string> res;
int main(){
cin>>t;
deck.push_back("#");
for(int i = 1;i <= 54;i++){
cin>>Shuffling[i];
deck.push_back(s[(i-1)/13] + to_string((i-1)%13+1));
}
res = deck;
while(t--){
for(int i = 1;i <= 54;i++){
res[Shuffling[i]] = deck[i];
}
deck = res;
}
for(int i = 1;i < 54;i++){
cout<<res[i]<<" ";
}
cout<<res[54];
}
8ms