이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n';
const int M = 2e6+5, MOD = 1e9+7;
int p[M];
signed main() {
cin.tie(0)->sync_with_stdio(0);
p[0] = 1;
for (int i = 1; i < M; i++) p[i] = (p[i-1]*2)%MOD;
int n, k;
cin >> n >> k;
k--;
int ans = 0;
while (n--) {
if (k%2) {
ans += p[n];
ans %= MOD;
} k /= 2;
}
cout << ans+1 << endl;
return 0;
}
/*
4
14
9
8
12
6
2
3
5
7
11
13
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |