标签:代码 machine include iostream ++ pac 模仿 shuf ring
题意:模仿洗牌。
思路:比较简单,不说了。
代码:
#include <iostream> #include <string> #include <vector> #include <fstream> using namespace std; void init(vector<string>& card) { vector<string> digit={"","1","2","3","4","5","6","7","8","9","10","11","12","13"}; card.push_back(""); for(int i=1;i<=13;i++) card.push_back(string("S")+digit[i]); for(int i=1;i<=13;i++) card.push_back(string("H")+digit[i]); for(int i=1;i<=13;i++) card.push_back(string("C")+digit[i]); for(int i=1;i<=13;i++) card.push_back(string("D")+digit[i]); card.push_back(string("J")+digit[1]); card.push_back(string("J")+digit[2]); } int main() { //ifstream cin("pat.txt"); vector<string> card; init(card); vector<string> temp(55); int pos[55]; int k; cin>>k; for(int i=1;i<=54;i++) cin>>pos[i]; while(k--){ for(int i=1;i<=54;i++) temp[pos[i]]=card[i]; card=temp; } for(int i=1;i<=54;i++){ cout<<card[i]; if(i<54) cout<<‘ ‘; } return 0; }
标签:代码 machine include iostream ++ pac 模仿 shuf ring
原文地址:https://www.cnblogs.com/kkmjy/p/9556388.html