题解 | #整型数组合并#

整型数组合并

http://www.nowcoder.com/practice/c4f11ea2c886429faf91decfaf6a310b

while True:
    try:
        a = input()
        b = map(int,input().split())
        c = input()
        d = map(int,input().split())
        e = []
        #找到不重复的元素,放入空数组
        for i in b:
            if i not in e:
                e.append(i)
        for i in d:
            if i not in e:
                e.append(i)
        #升序排列,无连接符        
        print(''.join(map(str,sorted(e)))) 
        
        
    except:
        break
全部评论
用map吧,不用查重复
点赞 回复 分享
发布于 2022-05-27 10:51

相关推荐

06-20 21:22
已编辑
门头沟学院 Java
纯真的河老师在喝茶:答应了就跑啊,实习随便跑啊,别被pua了,md就是找个廉价劳动力,还平稳过度正式工,到时候跟你说没转正
点赞 评论 收藏
分享
星辰再现:裁员给校招生腾地方
点赞 评论 收藏
分享
评论
3
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务