| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1341774 | orgiloogii | Rack (eJOI19_rack) | C++20 | 1 ms | 368 KiB |
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
using namespace std;
const int mod = 1e9 + 7;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n, k;
cin >> n >> k;
int pows[n + 1] = {0};
pows[0] = 1ll;
for (int i = 1;i <= n;i++) {
pows[i] = pows[i - 1] * 2;
pows[i] %= mod;
}
int ans = 0;
for (int i = 0;i < n;i++) {
if (((k - 1) & (1ll << i)) != 0) {
ans += pows[n - i - 1];
ans %= mod;
}
}
cout << ans + 1 << endl;
}
//203957466| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
