BC120 争夺前五名
思路:
step1:输入后,用sort()函数倒序排列,然后打印;
代码如下:
n = int(input())
ls = list(map(int,input().split(' ')))
ls.sort(reverse = True)
c = []
for i in range(5):
c.append(ls[i])
for i in c:
print(i,end=' ')
n = int(input())
ls = list(map(int,input().split(' ')))
ls.sort(reverse = True)
c = []
for i in range(5):
c.append(ls[i])
for i in c:
print(i,end=' ')