题目描述
给定一个长度为n(2≤n≤1000)的整数序列,去除其中的重复元素并升序排列,输出结果。
比如,n=10,整数序列为:5, 6, 6, 6, 6, 9, 3, 7, 5, 5,去除重复元素后的升序序列为:3, 5, 6, 7, 9
又比如n=15,整数序列为:12, 12, 10, 9, 6, 11, 8, 5, 6, 3, 3, 7, 1, 11, 10,去除重复元素后的升序序列为:1, 3, 5, 6, 7, 8, 9, 10, 11, 12
输入
10
6 4 4 5 2 7 9 4 6 2
输出
2 4 5 6 7 9
这题熟悉几个函数就好了
f = int(input())
a = list(map(int, input().split()))
b = []
for i in a:
if i not in b:
b.append(i)
b.sort()
s = ' '.join(list(map(str, b)))
print(s)