이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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_ctzll(i)]) % mod;
if (i > k)
break;
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |