#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll pot(ll dl){
ll wyn = 1;
for(int i = 1; i < dl; ++i){
wyn *= 2;
wyn %= 1000000007;
}
return wyn;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,k;
cin >> n >> k;
ll pocz = 1, dl = n;
for(int i = 0; i < n; ++i){
//cout << pocz << ' ' << dl << ';' << k << '\n';
if(k % 2 == 0){
pocz += pot(dl);
dl--;
}
else{
dl--;
}
k = k/2 + k%2;
}
cout << pocz;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |