Submission #841574

#TimeUsernameProblemLanguageResultExecution timeMemory
841574WLZRack (eJOI19_rack)C++17
100 / 100
8 ms8028 KiB
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long) 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; long long k; cin >> n >> k; k--; vector<long long> pw(n); pw[0] = 1; for (int i = 1; i < n; i++) { pw[i] = (pw[i - 1] * 2) % MOD; } long long ans = 0; for (int i = n - 1; i >= 0; i--) { if (k % 2 == 1) { ans = (ans + pw[i]) % MOD; } k /= 2; } cout << ans + 1 << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...