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>
#include <math.h>
using namespace std;
int main()
{
long long n;
long long k;
//n2;
long long modul = 1e9 + 7;
cin >> n >> k;
k--;
//n2 = pow(2, n);
long long a = 1;
long long b = 1, p2s = n - 1;//, b = p2s;
/*if (k == 1)
{
cout << 1;
return 0;
}
if (k == 2)
{
cout << 1 + n2;
return 0;
}*/
while (p2s >= 0)
{
if (k % 2 == 1)
{
b = 1;
for (long long i = 0; i < p2s; i++)
{
b = b * 2;
b %= modul;
}
a = (a + b)% modul;
}
k = k / 2;
p2s--;
}
cout << a;
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... |