| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364617 | kmath628 | Rack (eJOI19_rack) | C++20 | 6 ms | 7952 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll p2[1000009];
int main(){
int n,i,c=0;
ll k,ans=0;
scanf("%d %lld",&n,&k);
p2[0]=1;
for(i=1;i<=n;i++) p2[i]=p2[i-1]*2%mod;
k--;
while(k>0){
if(k%2) ans+=p2[n-1-c];
c++;
k/=2;
}
ans=(ans+1)%mod;
printf("%lld\n",ans);
return 0;
}
Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
