제출 #244584

#제출 시각아이디문제언어결과실행 시간메모리
244584Matteo_VerzRack (eJOI19_rack)C++11
100 / 100
5 ms388 KiB
/* `-/oo+/- `` .oyhhhhhhyo.`od +hhhhyyoooos. h/ +hhyso++oosy- /s .yoooossyyo:``-y` ..----.` ``.-/+:.` `````..-::/. `..```.-::///` `-.....--::::/: `.......--::////: `...`....---:::://: `......``..--:::::///:` `---.......--:::::////+/` ----------::::::/::///++: ----:---:::::///////////:` .----::::::////////////:-` `----::::::::::/::::::::- `.-----:::::::::::::::- ...----:::::::::/:-` `.---::/+osss+:` ``.:://///-. */ #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <cmath> using namespace std; using i64 = long long; const int INF = 2e9; const int MOD = 1e9 + 7; i64 lgput(i64 b, i64 e) { i64 r(1); while(e) { if(e & 1) r = (r * b) % MOD; b = (b * b) % MOD; e >>= 1; } return r; } int main() { #ifdef BLAT freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif // BLAT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); i64 n, k, ans(0); cin >> n >> k; k--; for(i64 i = 0; (1LL << i) <= k; i++) { if(k & (1LL << i)) { ans = ans + lgput(2, n - i - 1); ans %= MOD; } } ans++; ans %= MOD; cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...