Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
67117 | 胡海峰老师 | 选择排序-函数 | Python3 | Accepted | 28 MS | 3792 KB | 353 | 2024-03-14 08:51:50 |
n = int(input()) a = list(map(int,input().split())) def selection(a): n = len(a) for i in range(n-1,0,-1): maxIdx = i for j in range(i): if a[j]> a[maxIdx]: maxIdx = j a[maxIdx],a[i] = a[i],a[maxIdx] return a a = selection(a) b = [str(x) for x in a] print( " ".join(b))