10920 | 2024-04-18 21:54:24 | 42 | Akasztós tartó | python3 | Accepted 100/100 | 386ms | 13300 KiB |
#from sys import stdin, stdout
#input=stdin.readline
mod=10**9+7
from math import log
def solv():
N,K = list(map(int, input().split()))
K-=1
res=0
for pow2 in range(N-1,-1,-1):
if K<=0:
break
if pow2 <= log(K,2):
res+=pow(2,N-1-pow2,mod)
K-=2**pow2
print((res+1)%mod)
solv()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 20/20 | ||||||
1 | Accepted | 17ms | 11276 KiB | ||||
2 | Accepted | 18ms | 11628 KiB | ||||
3 | Accepted | 17ms | 11816 KiB | ||||
4 | Accepted | 17ms | 12196 KiB | ||||
5 | Accepted | 17ms | 12240 KiB | ||||
subtask2 | 20/20 | ||||||
1 | Accepted | 17ms | 11988 KiB | ||||
2 | Accepted | 17ms | 12592 KiB | ||||
3 | Accepted | 17ms | 12584 KiB | ||||
4 | Accepted | 17ms | 12536 KiB | ||||
5 | Accepted | 17ms | 12940 KiB | ||||
subtask3 | 60/60 | ||||||
1 | Accepted | 17ms | 13024 KiB | ||||
2 | Accepted | 17ms | 13064 KiB | ||||
3 | Accepted | 19ms | 12964 KiB | ||||
4 | Accepted | 39ms | 13300 KiB | ||||
5 | Accepted | 386ms | 13116 KiB |