32 lines
685 B
C++
32 lines
685 B
C++
#include <iostream>
|
|
using namespace std;
|
|
int main(){
|
|
int n,x;
|
|
while (cin >> n >>x && (n!=0||x!=0)){
|
|
int *i = new int[n];
|
|
int *hea = i;
|
|
for(int j=0;j<n;j++)
|
|
cin >> i[j];
|
|
int j=0;
|
|
for(;j<n;j++){
|
|
if(i[j] > x){
|
|
cout << x << ' ';
|
|
break;
|
|
}
|
|
cout << i[j] << ' ';
|
|
}
|
|
if(j==n){
|
|
cout << x << endl;
|
|
} else
|
|
for(;j<n;j++){
|
|
cout << i[j];
|
|
if(j==n-1)
|
|
cout << endl;
|
|
else
|
|
cout << ' ';
|
|
}
|
|
|
|
delete[]i;
|
|
}
|
|
return 0;
|
|
} |