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>
using namespace std;
#define int long long
const int MODULO=1000*1000*1000+7,MAX_N=1000*1000+1;
int n,k,rep;
int multi[MAX_N];
vector<int> kBin;
signed main() {
ios_base::sync_with_stdio(false);
cin>>n>>k;
k--;
multi[0]=1;
for (int i=1;i<n;i++) {
multi[i]=multi[i-1]*2;
multi[i]%=MODULO;
}
for (int i=0;i<n;i++) {
kBin.push_back(k%2);
k/=2;
}
for (int i=n-1;i>=0;i--) {
rep+=multi[i]*kBin[n-i-1];
rep%=MODULO;
}
cout<<rep+1<<endl;
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... |