ABC361

学贵坚持發表於2024-07-11

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)