# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973274 | terracottalite | Rack (eJOI19_rack) | C++14 | 1 ms | 572 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 <stdio.h>
#define MOD 1000000007
long long fastpow(long long base, long long exp) {
if (exp == 0) return 1;
long long x = fastpow(base, exp / 2);
x = (x * x)%MOD;
if (exp&1) x = (x * base)%MOD;
return x;
}
int main()
{
int n, k;
scanf("%d %d", &n, &k);
k--;
int z = n-1;
long long ans = 0;
while (k) {
if (k&1) ans = (ans + fastpow(2, z))%MOD;
z--;
k >>= 1;
}
ans = (ans + 1)%MOD;
printf("%lld\n", ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |