题解 | 整型数组合并

n1=int(input())
a1=list(map(int,input().split()))

n2=int(input())
a2=list(map(int,input().split()))

s = []
for i in a1:
    for j in s:
        if j == i:
            break
    else:
        s.append(i)
for i in a2:
    for j in s:
        if j == i:
            break
    else:
        s.append(i)

for i in range(len(s)):
    for j in range(len(s)-i-1):
        if s[j] > s[j+1]:
            t = s[j]
            s[j] = s[j+1]
            s[j+1] = t

print("".join(map(str,s)))

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务