Commit 3884668b by BellCodeEditor

auto save

parent ad5af7ec
Showing with 15 additions and 2 deletions
# 使用二分查找法,找出9和20在列表里面的索引
num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
积分兑换尽快发送的空间划分大苏打实打实速度发货尽快是大家看法和士大夫艰苦的是附近的首发机会的三个u安慰哟,扩大生产cxzkc, mcxx
\ No newline at end of file
n=20
hight=len(num_list)-1
low=0
while True:
mid=(low+hight)//2
if num_list[mid]==n:
print('y')
break
elif num_list[mid]<n:
low=mid+1
elif hight>low:
print('m')
break
else:
hight=mid-1
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