list =[2,3,5,10,15,16,18,22] min=0 max=len(list) a=22 while min< max: mid=int((min+max)/2) num=list[mid] if a==num: print("你要找的数排在: "+str(mid+1)) if a>num: min=mid+1 else: max=mid
原文地址:https://www.cnblogs.com/fqqwz/p/11634599.html
时间: 2024-11-08 22:59:33