AcWing 5646. 打乱播放次序
原题链接
简单
作者:
yxc的小迷妹
,
2024-04-25 17:46:30
,
所有人可见
,
阅读 31
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
vector<char> playlist = {'A', 'B', 'C', 'D', 'E'};
int b, n;
while (cin >> b >> n)
{
if (b == 1)
for (int i = 0; i < n; ++i)
rotate(playlist.begin(), playlist.begin() + 1, playlist.end());
else if (b == 2)
for (int i = 0; i < n; ++i)
rotate(playlist.rbegin(), playlist.rbegin() + 1, playlist.rend());
else if (b == 3)
for (int i = 0; i < n; ++i)
swap(playlist[0], playlist[1]);
else if (b == 4)
{
for (char song : playlist)
cout << song << ' ';
puts("");
break;
}
}
return 0;
}