Commit 790f000a by BellCodeEditor

auto save

parent 1bc757f9
Showing with 3 additions and 15 deletions
a=[1,2,3,4,5,6,7,9,10,11,14,19,20,99,108]
low=0
high=len(a)
high=len(a)-1
num=int(input('你想要查找那个数字'))
while True :
mid=(high+low)//2
guess=a[mid-1]
if guess==num:
print('🆗了,索引是',mid)
break
elif guess>num:
high=mid-1
elif guess<num:
low=mid+1
else:
print('没有')
break
\ No newline at end of file
def ikun()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment