이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int fp(int a,int b){
if(b==0)return 1;
int t=fp(a,b/2);
t=(t*t)%MOD;
if(b%2)return (t*a)%MOD;
return t;
}
int32_t main(){
int n,k;
cin>>n>>k;
int ans=1;
k--;
for(int i=1;i<=1e18;i*=2){
if(k&i){
ans=(ans+(fp(2,n-1)*fp(i,MOD-2))%MOD)%MOD;
}
}
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... |