#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n, k;
cin >> n >> k;
vector <int> a; a.push_back(0);
int N = 1;
for (int i = 1; i <= n; i ++) N *= 2;
/*
0 -> 1 2
1 -> 3 4
2 -> 5 6
3 -> 7 8
4 -> 9 10
5 -> 11 12
*/
int k2 = k / 2 - 1; int x = 1;
for (int j = 20; j >= 0; j --) {
if (k2 & (1 << j)) {
// cout << j << endl;
x += N / (1 << (j + 2));
}
}
if (k % 2 == 1) {
cout << x << endl;
} else {
cout << x + N / 2 << endl;
}
// for (int i = 1; i < a.size(); i ++) cout << a[i] << ' ';
//cout << a[k] << endl;
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... |