题解 | #输入整型数组和排序标识,
输入整型数组和排序标识,对其元素按照升序或降序进行排序
https://www.nowcoder.com/practice/dd0c6b26c9e541f5b935047ff4156309
import sys count1 = 0 for line in sys.stdin: count1 +=1 if count1 == 1: num1 = int(line.strip()) elif count1 == 2: list1 = list(map(int,line.strip().split(" "))) elif count1 == 3: just1 = line.strip() if just1 == '0': re1 = sorted(list1) elif just1 == '1': re1 = sorted(list1,reverse=True) for i in re1: print(i,end=" ")