扑克洗牌
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <map>
#include <algorithm>
using namespace std;
void Createpoker(vector<string> &poker, string s)
{
for (int i = 1; i < 14; i++)
{
if (i > 9)
{
string str = s + "1";
char c = i%10 + '0';
str = str + c;
poker.push_back(str);
}
else
{
string str = s;
char c = i + '0';
str = str + c;
poker.push_back(str);
}
}
}
int main()
{
vector<string> poker;
Createpoker(poker, "S");
Createpoker(poker, "H");
Createpoker(poker, "C");
Createpoker(poker, "D");
poker.push_back("J1");
poker.push_back("J2");
int K;
cin>>K;
vector<int> sortnum;
int m = 54;
while(m--)
{
int x;
cin>>x;
sortnum.push_back(x - 1);
}
vector<string> result(54,"");
while(K--)
{
for (int i = 0; i < 54; i++)
{
result[sortnum[i]] = poker[i];
}
poker.clear();
poker.insert(poker.end(),result.begin(),result.end());
}
for (int i = 0; i < 53; i++)
{
cout<<result[i]<<" ";
}
cout<<result[53];
return 0;
}