A
link
先输出前\(k\)个,再输出\(x\),最后输出后面的。
点击查看代码
#include<bits/stdc++.h>
using namespace std;
int n,k,x;
signed main(){
cin >> n >> k >> x;
for(int i = 1;i <= n;++ i){
int a;
cin >> a;
cout << a << " ";
if(i == k) cout << x << " ";
}
return 0;
}
B
[link](https://atcoder.jp/contests/abc361/tasks/abc361_b)