帮忙悬五官
  • 板块灌水区
  • 楼主yvanshenmi
  • 当前回复12
  • 已保存回复12
  • 发布时间2024/7/6 20:22
  • 上次更新2024/7/6 22:21:33
查看原帖
帮忙悬五官
1228557
yvanshenmi楼主2024/7/6 20:22

Problem Statement You are given an integer sequence AA of length NN and integers KK and XX. Print the integer sequence BB obtained by inserting the integer XX immediately after the KK-th element of the sequence AA.

Constraints All input values are integers. 1 \le K \le N \le 1001≤K≤N≤100 1 \le A_i, X \le 1001≤A i ​ ,X≤100 Input The input is given from Standard Input in the following format:

NN KK XX A_1A 1 ​ A_2A 2 ​ \dots… A_NA N ​

Output Print the integer sequence BB obtained by inserting the integer XX immediately after the KK-th element of the sequence AA, in the following format:

B_1B 1 ​ B_2B 2 ​ \dots… B_{N+1}B N+1 ​

Sample Input 1Copy Copy 4 3 7 2 3 5 11 Sample Output 1Copy Copy 2 3 5 7 11 For K=3K=3, X=7X=7, and A=(2,3,5,11)A=(2,3,5,11), we get B=(2,3,5,7,11)B=(2,3,5,7,11).

Sample Input 2Copy Copy 1 1 100 100 Sample Output 2Copy Copy 100 100 Sample Input 3Copy Copy 8 8 3 9 9 8 2 4 4 3 5 Sample Output 3Copy Copy 9 9 8 2 4 4 3 5 3

2024/7/6 20:22
加载中...