题解 |
输入整型数组和排序标识,对其元素按照升序或降序进行排序
https://www.nowcoder.com/practice/dd0c6b26c9e541f5b935047ff4156309
num1 = input() num_list = [int(i) for i in input().split()] num3 = int(input()) if num3 == 0: for i in sorted(num_list): print(i,end=' ') elif num3 == 1 : for i in sorted(num_list)[::-1]: print(i,end=' ')