我也贴一下自己的代码吧~第一题 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

相关推荐

代码飞升_不回私信人...:别这样贬低自己,降低预期,放平心态,跟昨天的自己比。做好自己,反而会效率更高心态更好,加油兄弟
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务