题解 | 输入整型数组和排序标识,对其元素按照升序或降序排序
输入整型数组和排序标识,对其元素按照升序或降序进行排序
https://www.nowcoder.com/practice/dd0c6b26c9e541f5b935047ff4156309
n = int(input()) x = list(map(int, input().split())) out = int(input()) if out == 0: x = sorted(x, reverse=False) for i in x: print(i, end=" ") elif out == 1: x = sorted(x, reverse=True) for i in x: print(i, end=" ")