Submission #742092

#TimeUsernameProblemLanguageResultExecution timeMemory
742092bogdanvladmihaiRack (eJOI19_rack)C++14
100 / 100
6 ms4008 KiB
#include <iostream> #include <vector> const int M = 1e9 + 7; int main() { int N; int64_t K; std::cin >> N >> K; K--; std::vector<int> pow(N + 1, 1); for (size_t i = 1; i < pow.size(); i++) { pow[i] = pow[i - 1] + pow[i - 1]; if (pow[i] >= M) { pow[i] -= M; } } int answer = 1; for (int i = 0; i < 63; i++) { if ((K & (1LL << (int64_t)i)) > 0) { answer += pow[N - i - 1]; if (answer >= M) { answer -= M; } } } std::cout << answer << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...