#include <iostream>
#include <vector>
#include <set>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#define int long long
const int mod = 1e9+7;
using namespace std;
int32_t main() {
int n, k; cin >> n >> k;
vector<int> y(n+1, 1);
for(int i = 1; i <= n; i ++) y[i] = y[i-1] * 2;
int ind = k;
ind --;
int ans = 1;
while(ind != 0){
int i = log(ind);
(ans += (y[n-i-1] % mod)) %= mod;
ind -= y[i];
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Incorrect |
1 ms |
444 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Incorrect |
1 ms |
444 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Incorrect |
1 ms |
444 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |