arr=list(map(int,input().split()))
n=arr[0]
m=arr[1]
def get_sum(s):
total=0
for i in range(n):
total+=s
s=(s+1)//2
return total
low=1
high=m
while(low<=high):
mid=low+(high-low)//2
print(mid)
if get_sum(mid)==m:
print(mid)
break
elif get_sum(mid)<m:
low=mid+1
else:
high=mid-1
if low>high:
print(low-1)
二分查找变形
猜你喜欢
转载自blog.csdn.net/haoshan4783/article/details/89055990
今日推荐
周排行