# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097239 | vjudge1 | Rack (eJOI19_rack) | C++17 | 0 ms | 408 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>
using namespace std;
#define ll long long int
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n,k;
cin >> k>>n;
k=min(k,61LL);
vector<ll>a(k,0);
n--;
ll i =0 ;
while(n>0){
a[i]=n%2;
n/=2;
i++;
}reverse(a.begin(),a.end());
ll x = 0;
ll act = 1;
for(ll i=0;i<a.size();i++){
if(a[i]!=0)x+=act*a[i];
act*=2;
}cout << x+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... |