This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int Mod=1e9+7;
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0);
int n,i,w=1,p=1;
long long k;
cin >> n >> k; --k;
for (i=1; i<=n; i++)
{
if (k%2==0) w=((long long)2*w)%Mod;
else w=((long long)2*w+1)%Mod;
k=k/2;
}
for (i=1; i<=n; i++) p=((long long)2*p)%Mod;
cout << (w-(p-1)+Mod)%Mod << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |