gia nhu giai tich de hieu
NguyenAnhQuan
c_cpp
2 years ago
478 B
36
Indexable
#include <bits/stdc++.h>
#define ll long long
#define LIM 1000005
#define X first
#define Y second
#define EL cout<<"\n"
using namespace std;
int a[LIM];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, x, k;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
cin >> x >> k;
for (int i = n; i >= k + 1; i--)
a[i] = a[i - 1];
a[k] = x;
for (int i = 0; i <= n; i++)
cout << a[i] << " ";
return 0;
}Editor is loading...