zoukankan      html  css  js  c++  java
  • python 整形数组合并

    地址:https://www.nowcoder.com/practice/c4f11ea2c886429faf91decfaf6a310b?tpId=37&&tqId=21303&rp=1&ru=/ta/huawei&qru=/ta/huawei/question-ranking


    1
    ''' 2 描述 3 题目标题: 4 5 将两个整型数组按照升序合并,并且过滤掉重复数组元素。 6 输出时相邻两数之间没有空格。 7 请注意本题有多组样例。 8 9 10 11 输入描述: 12 输入说明,按下列顺序输入: 13 1 输入第一个数组的个数 14 2 输入第一个数组的数值 15 3 输入第二个数组的个数 16 4 输入第二个数组的数值 17 18 输出描述: 19 输出合并之后的数组 20 21 示例1 22 输入: 23 3 24 1 2 5 25 4 26 -1 0 3 2 27 输出: 28 -1012 29 30 ''' 31 32 33 while(True): 34 try: 35 n= int(input()) 36 except: 37 break 38 nList = input().split() 39 m = int(input()) 40 mList = input().split() 41 nm = nList + mList 42 nmInt = [int(i) for i in nm] 43 nmIntNew = sorted(set(nmInt)) 44 s = '' 45 for i in nmIntNew: 46 s += str(i) 47 print(s)
  • 相关阅读:
    centos-docker安装及基本使用
    List集合-03.Vector
    List集合-02.LinkedList
    List集合-01.ArrayList
    常用图像处理方法
    git使用
    bug记录
    bash vim等常用命令
    python常用
    MTCNN试用
  • 原文地址:https://www.cnblogs.com/whycai/p/14819908.html
Copyright © 2011-2022 走看看