include [HTML_REMOVED]
using namespace std;
const int N = 1000;
int a[N];
int direct[N];
int main(){
int n;
int length;
int t;
int ball[N];
cin>>n>>length>>t;
for(int i = 0; i < n; i){
direct[i] = 1;
}
for(int i = 0;i < n;i ){
int x;
cin>>x;
ball[i] = x;
}
for(int i = 0;i < t; i){
for(int j = 0;j < n;j ){
bool flag = true;
for(int k = 0;k < n;k ){
if(k != j && ball[k] == ball[j]){
flag = false;
direct[k] = -1 * direct[k];
}
}
}
for(int j = 0;j < n;j){
if(ball[j] == 0 || ball[j] == length)direct[j] = -1 * direct[j];
}
for(int j = 0;j < n;j ++){
ball[j] += direct[j];
}
}
for(int i = 0;i < n;i ++)cout<<ball[i]<<" ";
}
这样就好多了