Commit f5f32c6b by BellCodeEditor

auto save

parent d662eba9
Showing with 2 additions and 2 deletions
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21] num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
num=20 num=20
low,high=0,len(num_list) low,high=0,len(num_list)
while True: guess=0
while guess==num:
mid=(low+high)//2 mid=(low+high)//2
guess=num_list[mid] guess=num_list[mid]
if guess==num: if guess==num:
print("找到了") print("找到了")
pop()
elif guess<num: elif guess<num:
low=mid+1 low=mid+1
print(guess) print(guess)
......
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