#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
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
15956 KB |
Output is correct |
2 |
Correct |
17 ms |
15976 KB |
Output is correct |
3 |
Correct |
14 ms |
15956 KB |
Output is correct |
4 |
Correct |
14 ms |
15856 KB |
Output is correct |
5 |
Correct |
16 ms |
15912 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
15956 KB |
Output is correct |
2 |
Correct |
17 ms |
15976 KB |
Output is correct |
3 |
Correct |
14 ms |
15956 KB |
Output is correct |
4 |
Correct |
14 ms |
15856 KB |
Output is correct |
5 |
Correct |
16 ms |
15912 KB |
Output is correct |
6 |
Correct |
16 ms |
15936 KB |
Output is correct |
7 |
Correct |
17 ms |
15932 KB |
Output is correct |
8 |
Correct |
15 ms |
15872 KB |
Output is correct |
9 |
Correct |
16 ms |
15848 KB |
Output is correct |
10 |
Correct |
15 ms |
15916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
15956 KB |
Output is correct |
2 |
Correct |
17 ms |
15976 KB |
Output is correct |
3 |
Correct |
14 ms |
15956 KB |
Output is correct |
4 |
Correct |
14 ms |
15856 KB |
Output is correct |
5 |
Correct |
16 ms |
15912 KB |
Output is correct |
6 |
Correct |
16 ms |
15936 KB |
Output is correct |
7 |
Correct |
17 ms |
15932 KB |
Output is correct |
8 |
Correct |
15 ms |
15872 KB |
Output is correct |
9 |
Correct |
16 ms |
15848 KB |
Output is correct |
10 |
Correct |
15 ms |
15916 KB |
Output is correct |
11 |
Correct |
17 ms |
15896 KB |
Output is correct |
12 |
Correct |
16 ms |
15884 KB |
Output is correct |
13 |
Correct |
15 ms |
15860 KB |
Output is correct |
14 |
Correct |
16 ms |
16008 KB |
Output is correct |
15 |
Correct |
17 ms |
15964 KB |
Output is correct |