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 <bits/stdc++.h>
#define ll long long
#define pb push_back
#define left (node<<1),l,((l+r)>>1)
#define right ((node<<1)|1),((l+r)>>1) + 1,r
#define s second
#define f first
#define pii pair<int,int>
#define mod 1000000007
using namespace std;
const int N = 1000005;
int pwr[N];
int main (){
ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
int n,k;
cin>>n>>k;
pwr[0] = 1;
for (int i = 1; i <= n; i++)
pwr[i] = (pwr[i - 1]*2)%mod;
int ans = 1;
while (n){
if (!(k%2)) ans += pwr[n - 1];
n--;
k = (k + 1)/2;
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |