#include<iostream>
using namespace std;
struct Ball
{
int a;
bool s;
};
int main()
{
int n, l, t;
cin >> n >> l >> t;
Ball b[100];
for (int i = 0; i < n; i++)
{
cin >> b[i].a;
b[i].s = true;
}
for (int k = 1; k <= t; k++)
{
for (int i = 0; i < n; i++)
{
if (b[i].a == l)
b[i].s = false;
else if (b[i].a == 0)
b[i].s = true;
for (int j = 0; j < n; j++)
{
if (b[i].a == b[j].a && i != j)
{
if (b[i].s == true)
{
b[i].s = false;
b[j].s = true;
}
else
{
b[i].s = true;
b[j].s = false;
}
}
}
if (b[i].s == true)
b[i].a++;
else
b[i].a--;
}
}
for (int i = 0; i < n; i++)
{
cout << b[i].a << " ";
}
return 0;
}
来源:CSDN
作者:▇ 楠墙
链接:https://blog.csdn.net/qq_44452887/article/details/104523976