// Try to be as positive as natural numbers :)
#include "bits/stdc++.h"
#define int long long
int pw(int a, int b) {
int ans = 1;
while (b > 0) {
if (b & 1) {
ans *= a;
}
a *= a;
b >>= 1;
}
return ans;
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, k;
std::cin >> n >> k;
n = pw(2, n);
int cs = n >> 1;
std::vector<int> o;
for (int i = 1; i <= n / 2; i += 2) {
o.push_back(i), o.push_back(i + cs);
}
for (int i = 2; i <= n / 2; i += 2) {
o.push_back(i), o.push_back(i + cs);
}
int ans = 0;
for (int i = 1; i <= n; ++i) {
if (o[i - 1] != k) {
continue;
}
ans = i;
break;
}
std::cout << ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |