이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define ll long long
#define pb push_back
#define mod 1000000007
inline ll int hmm(ll int r,ll int k){
if(r==1)return 1;
ll int m=(1+r)/2;
m=m%mod;
//cout<<r<<" "<<m<<endl;
if(k%2==0&&k!=0){
return m+hmm(m,k/2);
}
else return hmm(m,(k+1)/2);
}
int main(){
lalala;
ll int n,k;cin>>n>>k;
ll int arr[n+1];
arr[0]=1;
for(int i=1;i<=n;i++){
arr[i]=(arr[i-1]*(ll int)2)%mod;
}
cout<<hmm(arr[n],k)<<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... |