10-19 AC
This commit is contained in:
32
2019.cpp
Normal file
32
2019.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user