This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;
signed main() {
int n, k;
cin >> n >> k;
int ans = 0;
while(n--) {
if (!(k&1)) {
ans = (ans << 1)%MOD;
ans++;
k /= 2;
} else {
ans = (ans << 1)%MOD;
k= k/2 + 1;
}
}
cout << (ans+1)%MOD << '\n';
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... |