Commit b091eadb by BellCodeEditor

save project

parent 23a4dc48
Showing with 7 additions and 6 deletions
......@@ -3,14 +3,15 @@ num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
num=20
low,high=0,len(num_list)
guess=0
while guess==num:
while guess!=num:
mid=(low+high)//2
guess=num_list[mid]
if guess==num:
print("找到了")
elif guess<num:
if guess<num:
low=mid+1
print(guess)
else:
high=mid-1
print(guess)
\ No newline at end of file
print(guess)
if guess==num:
print("找到了")
\ 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