Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
67116 胡海峰老师 选择排序-函数 Python3 Accepted 30 MS 3776 KB 293 2024-03-14 08:50:29

Tests(1/1):


Code:

""" 10 1 3 5 7 9 10 6 4 2 8 """ n = int(input()) a = list(map(int,input().split())) 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] b = [str(x) for x in a] print( " ".join(b))