Submission #1258405

#TimeUsernameProblemLanguageResultExecution timeMemory
1258405dhananRack (eJOI19_rack)C++20
40 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const ll MOD = 1e10 + 7;
ll n, k, ans = 1;
ll modpow ( ll a, ll b){
    ll res = 1;

    while(b != 0){
        if(b % 2 == 1){
            res = (res * a)% MOD;
        }
            b/= 2;
            a = (a * a) % MOD;
        
    }
    return res;
}

int main(){
    cin >> n >> k;
    for(int i = n - 1; i >= 0; i--){
        if(!(k % 2)){
            ans = (ans + modpow (2, i)) % MOD;
        }
        k = (k + 1) / 2;
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...