解题思路:切片就能写出来,问题是题目中说到“数组a中只需改变n个元素”,也就是说当m1+n1<m的时候第一个数组中剩下的元素也要加上不能去掉
跟你玩文字游戏
参考代码:
a,b=map(int,input().split())
c=input().split()
d=input().split()
e,f=map(int,input().split())
if e+f<a:
h = c[0:e] + d[0:f] + c[e+f:]
else:
h=c[0:e]+d[0:f]
print(",".join(h))
0.0分
1 人评分