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