第一行输入一个整数
代表数组中的元素个数。
第二行输入
个整数
代表数组中的元素。
第三行输入一个整数
代表排序方式,其中,
表示按升序,
表示按降序。
在一行上输出
个整数,代表排序后的数组。
5 1 2 2 5 4 0
1 2 2 4 5
5 1 2 2 4 5 1
5 4 2 2 1
n=int(input())
m=list(map(int,input().split(" ")))
k=int(input())
if k==0:
i=False
else:
i=True
print(" ".join(map(str,sorted(m,reverse=i)))) input()
ls = list(map(int,input().split()))
ls.sort(reverse=int(input()))
print(' '.join(list(map(str,ls)))) # 1. 接收输入,转数字
ns = input()
ls = input()
ls_list = ls.split(' ')
ls_num_list = [int(x) for x in ls_list]
t = input()
# 判断范围,可省略
if int(ns) < 1&nbs***bsp;int(ns) > 1000:
exit()
for item in ls_list:
if int(item) < 0&nbs***bsp;int(item) > 100000:
exit()
# 排序
if t == '0':
ls_num_list.sort()
elif t == '1':
ls_num_list.sort(reverse=True)
# 输出
for i in ls_num_list:
print(i, end=' ') input()
list_initial = input().split()
list_output = []
for i in range(len(list_initial)):
list_output.append(int(list_initial[i]))
list_output.sort(reverse=int(input()))
print(' '.join(list(map(str,list_output)))) # 解法一
while True:
try:
_ = input()
# 输入按空格分隔然后map为整数再转为list
s = list(map(int, input().split(" ")))
# 布尔型变量判断0/1
flag = bool(int(input()))
# 按flag的是否来升序或者降序排列
s = sorted(s, reverse=flag)
for i in s:
print(i, end=" ")
except:
break
# 解法二
while True:
try:
_ = input()
# 直接分隔
s = input().split(" ")
# 布尔型变量判断0/1
flag = bool(int(input()))
# 指定类型后,按flag的是否来升序或者降序排列
s = sorted(s, key = int, reverse=flag)
for i in s:
print(i, end=" ")
except:
break
num = int(input())
input_str = input()
input_array = [int(i) for i in input_str.split(" ")]
tag = int(input())
if tag == 0:
input_array.sort()
else:
input_array.sort(reverse=True)
out = ""
for i in range(len(input_array)):
out += str(input_array[i])
if i < len(input_array) - 1:
out += " "
print(out) n = int(input())
num = list(map(int,input().split()))
a = int(input())
if n in range(1,1001):
if a == 0:
num.sort()
elif a ==1:
num.sort(reverse=True)
else:
print('输入错误')
for i in num:
print(i,end=' ')