Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
70698 | 张智博 | 打印每一趟插入排序 | Python3 | Accepted | 34 MS | 3788 KB | 340 | 2024-04-16 21:14:34 |
def insertion_sort(arr): for i in range(1, len(arr)): key = arr[i] j = i - 1 while j >= 0 and arr[j] > key: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key print(' '.join(map(str, arr))) n = int(input()) data = list(map(int, input().split())) insertion_sort(data)