# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
631215 | typ | Rack (eJOI19_rack) | C++14 | 10 ms | 1236 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;
const long long MOD = 1e9+7;
long long n, k, pom=1, liczba=1;
main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
k--;
stack<bool> bin;
for(int i=0;i<n;i++)
{
bin.push(k%2);
k/=2;
}
while(n--)
{
if(bin.top())
liczba = (liczba+pom)%MOD;
bin.pop();
pom = (2*pom)%MOD;
}
cout<<liczba;
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... |