Information
- ID
- 557
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- 10
- Tags
- # Submissions
- 4
- Accepted
- 4
- Uploaded By
#include<bits/stdc++.h>
using namespace std;
int a[1010],n,x,y,i,p;
int main()
{
cin >> n >> x >> y;
for(i = 1; i <= n; i++){
cin >> a[i];
if(a[i] == x) p = i;
}
for(i = n; i > p; i--){
a[i+1] = a[i];
}
a[p+1] = y;
n++;
for(i = 1; i <= n; i++) cout << a[i] << " ";
return 0;
}
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.