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 rep(i, n, a) for (int i = a; i < n; i++)
#define lint long long
using namespace std;
const int MOD = 1e9+7;
signed main()
{
int n, k;
cin >> n >> k;
int res=0;
vector<int>bits(n);
bits[0]=1;
rep(i, n, 1){
bits[i]=bits[i-1]*2;
bits[i]%=MOD;
}
rep(i, n, 0){
if((k>>i)&&i){
res+=bits[n-i];
res%=MOD;
}
}
cout << res + 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |