我也贴一下自己的代码吧~第一题 A = list(map(int, input().split())) B = list(map(int, input().split())) A.append(float("inf")) A.insert(0,-float("inf")) index = 1 for i in range(1,len(A)): if A[i] <= A[i-1]: index = i break res = -float("inf") for i in range(len(B)): if B[i] < A[index+1] and res < B[i] and B[i] > A[index-1]: res = B[i] if res == -float("inf"): index -= 1 for i in range(len(B)): if B[i] < A[index + 1] and res < B[i] and B[i] > A[index - 1]: res = B[i] if res == -float("inf"): print("NO") else: A[index] = res for e in range(1, len(A) - 1): print(A[e], end=" ") else: A[index] = res for e in range(1,len(A)-1): print(A[e],end=" ")
点赞 10

相关推荐

03-17 15:08
已编辑
腾讯_后端开发(准入职员工)
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客企业服务