Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
108410 丁俊杰 寻找第二小的数 Python3 Accepted 38 MS 3748 KB 409 2025-01-20 11:18:29

Tests(1/1):


Code:

c=int(input()) for i in range(c): n=int(input()) a=list(map(int,input().split())) a=set(a) #将列表a转化为集合a,目的是将a中重复的元素去掉,只保留其中一个 a=sorted(a) #将集合a又转化为列表a,并将其中的元素从小到大排序 if len(a)>=2: #有第二小的数 print(a[1]) else: print("NO")