Submission #282392

#TimeUsernameProblemLanguageResultExecution timeMemory
282392lani1akeaRack (eJOI19_rack)C++17
100 / 100
2 ms512 KiB
#include <bits/stdc++.h> #define F first #define S second #define ll long long #define pb push_back #define endl '\n' using namespace std; const int MOD = 1e9+7; ll e(ll a, ll b) { if (!b) return 1; ll res = e(a, b / 2); if (b % 2) return (res * res * a) % MOD; return (res * res) % MOD; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, k; cin >> n >> k; ll ans = 1; for (int i = n - 1; i >= 0; --i) { if (!(k % 2)) { ans = (ans + e(2, i)) % MOD; } k = (k + 1) / 2; } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...