#include <iostream>
#include <vector>
#include <random>
using namespace std;
random_device rd;
mt19937_64 gen(rd());
void print(vector<int>& arr)
{
for (auto& x : arr)
cout << x << " ";
cout << "\n";
}
void cyclic_shift(vector<int>& arr, int n)
{
n = n % (int)arr.size();
vector<int> tmp(arr.begin(), arr.begin() + n);
arr.erase(arr.begin(), arr.begin() + n);
arr.insert(arr.end(), tmp.begin(), tmp.end());
}
void insert_in(vector<int>& arr, int n = 3)
{
vector<int> tmp(arr.begin(), arr.begin() + n);
arr.erase(arr.begin(), arr.begin() + n);
int pos = uniform_int_distribution<>(1, arr.size() - 1)(gen);
arr.insert(arr.begin() + pos, tmp.begin(), tmp.end());
}
void lucky(vector<int>& arr, int n = 4)
{
while (n--)
{
arr.push_back(*arr.begin());
arr.erase(arr.begin());
arr.erase(arr.begin());
}
}
int main()
{
int a, b, c, d;
vector<int> arr;
cin >> a >> b >> c >> d;
int N = 10;
cout << "\n\n\n\n";
while (N--)
{
for (int i = 0; i < 2; i++)
{
arr.push_back(a);
arr.push_back(b);
arr.push_back(c);
arr.push_back(d);
}
print(arr);
int name_len = uniform_int_distribution<>(1, 100)(gen);
cyclic_shift(arr, name_len); // 名字,循环移位
cout << "名字长度 = " << name_len << ",循环移位\n";
print(arr);
insert_in(arr); // 顶部三张插入
cout << "顶部三张插入中间\n";
print(arr);
int result_1 = arr[0];
arr.erase(arr.begin()); // 第一张藏起来
cout << "第一张取出,藏起来\n";
print(arr);
int n1 = uniform_int_distribution<>(1, 3)(gen); // 南方北方,插入
insert_in(arr, n1);
cout << "南方北方,插入前"<< n1 << "\n";
print(arr);
int n2 = uniform_int_distribution<>(1, 2)(gen);; // 男生女生 扔掉
arr.erase(arr.begin(), arr.begin() + n2);
if (n2 == 1) cout << "男生扔掉顶部1张\n";
else cout << "女生扔掉顶部2张\n";
print(arr);
cyclic_shift(arr, 7); // 见证奇迹的时刻,七个字循环移位
cout << "见证奇迹的时刻,七个字循环移位\n";
print(arr);
lucky(arr, 4); // 好运留下,烦恼丢出 做4次
cout << "好运留下,烦恼丢出 做4次\n";
print(arr);
if (n2 == 1)
{
cout << "男生好运留下,烦恼丢出,再做1次,男生结果\n";
lucky(arr, 1);
cout << "最后剩下: "; print(arr);
cout << "藏起来: " << result_1 << endl;
}
else
{
cout << "女生结果:\n";
cout << "最后剩下: "; print(arr);
cout << "藏起来: " << result_1 << endl;
}
arr.clear();
cout << "\n\n\n\n\n";
}
}