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 = 1000000007;
signed main(){
long long n,k;cin>>n>>k;
k--;
long long ans=1;
long long add=n;
vector<long long > power(n+2);
power[0]=1;
for(int i =1;i<=n;i++){
power[i] = 2*power[i-1]%MOD;
}
for(int i=0;i<n;i++){
add--;
if((k)&1){
//right
ans +=power[add];
ans%=MOD;
}
k/=2;
}
cout<<ans%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... |