This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// author: Halit
#include <bits/stdc++.h>
int main() {
int64_t n, k;
std::cin >> n >> k;
int64_t res = 1, pow = 1, mod = 1e9 + 7;
for (int i = 1;i <= n; ++i, (k = (k+1)/2)) {
if (k % 2 == 0) res = (res<<1|1)%mod;
else res = (res<<1)%mod;
pow = (pow * 2) % mod;
}
pow = (pow - 1 + mod) % mod;
res = (res - pow + mod) % mod;
std::cout << res << std::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... |