标签:random python int def 数组 range import dom top
## 假设升序,
import random
def find(y):
l,m=len(y),0
while l>1:
n=int(l/2)
if y[0]<y[n]:
y=y[n:]
else:
y=y[:n]
m+=l-n
l=len(y)
return m
stop=1000
x=[x for x in range(0,stop)]
ans=random.randrange(0,stop)
print(‘answer is %s‘%str(ans))
y=x[ans:]+x[0:ans]
print(find(y))
标签:random python int def 数组 range import dom top
原文地址:https://www.cnblogs.com/offline-ant/p/9462901.html