Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
67108 彭士宝 优化冒泡排序 Python3 Accepted 540 MS 4004 KB 292 2024-03-13 22:07:03

Tests(10/10):


Code:

n = int(input()) a = list(map(int,input().split())) for i in range(n-1): swap = False for j in range(n-i-1): if a[j]<a[j+1]: a[j],a[j+1] = a[j+1],a[j] swap = True if swap == False: break b = [str(x) for x in a] print(' '.join(b))