This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#define int long long
using namespace std;
const long long mod=1e9+7;
int32_t main()
{
long long n, k;
cin >> n >> k;
long long res = 0;
k--;
for (long long i = n - 1; i >= 0; i--) {
int child = k & 0b1;
k = k >> 1;
res = (res + (child << i) % mod ) % mod;
}
cout << (res + 1) % mod;
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... |