# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448767 | UltraFalcon | Rack (eJOI19_rack) | C++17 | 0 ms | 0 KiB |
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>
#define int int_128_t
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
const int limit = (1e9) + 7;
int n, k;
cin >> n >> k;
k--;
int i = n-1;
int r = 1;
while (i >= 0) {
if (k % 2 == 1) {
//assert(i < 60);
r = (r + ((1ll << i) % limit)) % limit;
}
k /= 2;
i--;
}
cout << r % limit << "\n";
}