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 <iostream>
using namespace std;
int main() {
int n; long long k; cin >> n >> k; k--;
int t[n]; t[0] = 1;
for (int i = 1, j = 1; i <= n; i++) {
j *= 2; j %= 1000000007;
t[i] = j;
}
int res = 0;
for (int i = n - 1; i >= 0; i--) {
if (k & 1) {
res += t[i];
res %= 1000000007;
} k >>= 1;
}
cout << res + 1 << 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... |