#include <iostream> #include <string> #include <vector> using namespace std; string poker[53] = { "XX", "SA", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "S10", "SJ", "SQ", "SK", "HA", "H2", "H3", "H4", "H5", "H6", "H7", "H8", "H9", "H10", "HJ", "HQ", "HK", "DA", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "D10", "DJ", "DQ", "DK", "FA", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "FJ", "FQ", "FK" }; int main() { int n,cmd,a,b,d,k; vector <int> v,temp,ans; for(int i=0;i<52;++i) { v.push_back(i+1); } cin>>n; while(n--) { cin>>cmd; temp.clear(); ans.clear(); if(cmd==1) { cin>>a>>b; a--; b--; for(int i=a;i<=b;++i) { temp.push_back(v[a]); v.erase(v.begin()+a); } ans.insert(ans.end(),temp.begin(),temp.end()); ans.insert(ans.end(),v.begin(),v.end()); } else if(cmd==2) { cin>>a>>b; a--; b--; for(int i=a;i<=b;++i) { temp.push_back(v[a]); v.erase(v.begin()+a); } ans.insert(ans.end(),v.begin(),v.end()); ans.insert(ans.end(),temp.begin(),temp.end()); } else if(cmd==3) { cin>>k; for(int i=52-k;i<52;++i) { temp.push_back(v[k]); v.erase(v.begin()+k); } ans.insert(ans.end(),temp.begin(),temp.end()); ans.insert(ans.end(),v.begin(),v.end()); } else { cin>>k; for(int i=0;i<k;++i) { temp.push_back(v[0]); v.erase(v.begin()); } ans.insert(ans.end(),v.begin(),v.end()); ans.insert(ans.end(),temp.begin(),temp.end()); } v=ans; } for(int i=0;i<5;++i) { cout<<poker[v[i]]<<' '; } cout<<endl; }
不知道哪裡沒考慮清楚