为什么只有40分??
查看原帖
为什么只有40分??
1155874
XieMarch49281楼主2024/3/16 16:30

def ticket(alist): total=len(alist)-1 enchange=True while total>0 and enchange: enchange=False for i in range(total): if alist[i]>alist[i+1]: enchange=True alist[i],alist[i+1]=alist[i+1],alist[i] total-=1 return alist n,m=map(int,input().split(" ")) alist=list(map(int,input().split(" "))) print(" ".join(str(n) for n in ticket(alist)))

2024/3/16 16:30
加载中...