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