我用冒泡排序为什么只能通过20%: def func(tmp,N): count = 0 while N: for i in range(N-1): if tmp[i]>tmp[i+1]: tmp[i],tmp[i+1] = tmp[i+1],tmp[i] count += 1 N -= 1 return count if __name__ == '__main__': N = int(input()) tmp = [] for i in range(N): tmp.append(input()) out = func(tmp,N) print(out)
点赞

相关推荐

01-14 12:34
门头沟学院 C++
牛马人的牛马人生:太暖心了啊 配环境是真烦
点赞 评论 收藏
分享
迷茫的大四🐶:28?别太离谱,研究生出来也得25至少了
牛客吐槽大会
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务