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)
二分查找变形
最新推荐文章于 2023-12-22 13:16:35 发布