#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
#define mod 1000000007
#define MAXN 1000005
ll n, k;
ll pow2[MAXN];
int main() {
fast
pow2[0] = 1;
for (ll i = 1; i < MAXN; i++)
pow2[i] = (pow2[i-1] * 2) % mod;
cin >> n >> k;
ll ans = 1;
for (ll i = 2; i <= LLONG_MAX; i*=2) {
if (k % i == 0 || k % i > i/2)
ans = (ans + pow2[n-__builtin_ctz(i)]) % mod;
if (i > k)
break;
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
8148 KB |
Output is correct |
2 |
Correct |
7 ms |
8272 KB |
Output is correct |
3 |
Correct |
7 ms |
8156 KB |
Output is correct |
4 |
Correct |
7 ms |
8140 KB |
Output is correct |
5 |
Correct |
7 ms |
8020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
8148 KB |
Output is correct |
2 |
Correct |
7 ms |
8272 KB |
Output is correct |
3 |
Correct |
7 ms |
8156 KB |
Output is correct |
4 |
Correct |
7 ms |
8140 KB |
Output is correct |
5 |
Correct |
7 ms |
8020 KB |
Output is correct |
6 |
Correct |
7 ms |
8148 KB |
Output is correct |
7 |
Correct |
7 ms |
8148 KB |
Output is correct |
8 |
Correct |
8 ms |
8068 KB |
Output is correct |
9 |
Correct |
7 ms |
8148 KB |
Output is correct |
10 |
Correct |
7 ms |
8020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
8148 KB |
Output is correct |
2 |
Correct |
7 ms |
8272 KB |
Output is correct |
3 |
Correct |
7 ms |
8156 KB |
Output is correct |
4 |
Correct |
7 ms |
8140 KB |
Output is correct |
5 |
Correct |
7 ms |
8020 KB |
Output is correct |
6 |
Correct |
7 ms |
8148 KB |
Output is correct |
7 |
Correct |
7 ms |
8148 KB |
Output is correct |
8 |
Correct |
8 ms |
8068 KB |
Output is correct |
9 |
Correct |
7 ms |
8148 KB |
Output is correct |
10 |
Correct |
7 ms |
8020 KB |
Output is correct |
11 |
Correct |
8 ms |
8140 KB |
Output is correct |
12 |
Incorrect |
7 ms |
8020 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |