제출 #1245284

#제출 시각아이디문제언어결과실행 시간메모리
1245284kchu_zRack (eJOI19_rack)C++20
100 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; const unsigned long long MOD = 1e9 + 7; unsigned long long power(unsigned long long exp) { if (exp == 0) return 1; if (exp % 2 == 0) { unsigned long long x = power(exp / 2); return (x * x) % MOD; } return (2 * power(exp - 1)) % MOD; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); unsigned long long n, k, s = 0; cin >> n >> k; k--; for (unsigned long long mask = 0; mask < 64; mask++) { if (k & (1LL << mask)) s = (s + power(n - 1 - mask)) % MOD; } cout << (s + 1) % MOD << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...