# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
763761 | NemanjaSo2005 | Rack (eJOI19_rack) | C++17 | 11 ms | 2328 KiB |
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
using namespace std;
ll N,K,MOD=1e9+7;
string ubin(ll x){
string ret;
while(x){
ret.push_back(x%2);
x/=2;
}
return ret;
}
ll udec(string a){
ll st=1,ret=0;
for(int i=a.size()-1;i>=0;i--){
ret=(ret+a[i]*st)%MOD;
st=(st*2)%MOD;
}
return ret;
}
int main(){
cin>>N>>K;
string a=ubin(K-1);
while(a.size()<N)
a.push_back(0);
cout<<udec(a)+1<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |