Commit 22120974 by BellCodeEditor

save project

parent bc12b98e
Showing with 6 additions and 10 deletions
...@@ -5,14 +5,11 @@ high=len(num_list)-1 ...@@ -5,14 +5,11 @@ high=len(num_list)-1
low= 0 low= 0
while low<=high: while low<=high:
mid=(high+low)//2 mid=(high+low)//2
guess_num=num_list[mid] guess_num=int(num_list[mid])
if guess_num==bingo_num: if guess_num==bingo_num:
print('找到了') print(mid)
break exit()
elif guess_num<bingo_num: elif guess_num < bingo_num:
high=mid-1
elif guess_num>bingo_num:
low=mid+1 low=mid+1
elif guess_num > bingo_num:
high=mid-1
\ 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