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;
#define ll long long
#define endl "\n"
#define all(aa) aa.begin(), aa.end()
#define mod 1'000'000'007
ll fp(int base, int power){
if(!power) return 1;
ll res = fp(base, power/2);
if(power&1) return res * res % mod * base % mod;
else return res * res % mod;
}
int main(){
ll n, k;
cin>>n>>k;
ll ans=1;
while(n--){
if(k%2==0) ans=(ans+fp(2, n))%mod;
k=(k+1)/2;
}
cout<<ans<<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... |