#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9+7;
int bs(int pw){
if(pw==1)return 2;
int ans = bs(pw/2);
ans*=ans;
ans%=mod;
if(pw&1)ans*=2;
return ans%mod;
}
signed main()
{
int n, k;
cin >> n >> k;
int ans=1;
int cnt=1;
k--;
while(k>0){
if(k&1){
ans+=bs(n-cnt);
}
ans%=mod;
cnt++;
k/=2;
}
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Runtime error |
45 ms |
102400 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Runtime error |
45 ms |
102400 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Runtime error |
45 ms |
102400 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |