이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9+7;
long long lgput(int b, int e)
{
long long p=1;
while(e)
{
if(e%2==1)
{
e--;
p=(1LL*p*b)%Mod;
}
else
{
e/=2;
b=(1LL*b*b)%Mod;
}
}
return p;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
long long n,k;
cin>>n>>k;
long long rez=1;
while(k!=1)
{
--n;
if(k%2==0)
{
rez+=lgput(2,n);
rez%=Mod;
}
k=(k+1)/2;
}
cout<<rez<<'\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |