This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int t,n,a,b,cevap,k,pw[1000005];
inline int add(int x,int y){
if(x+y>=1000000007)return x+y-1000000007;
return x+y;
}
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n>>k;
pw[0]=1;
for(int i=1;i<=n;i++){
pw[i]=add(pw[i-1],pw[i-1]);
}
cevap=1;
int us=n-1;
while(k!=1){
if(k%2==0)cevap=add(cevap,pw[us]);
us--;
k=(k+1)/2;
}
cout<<cevap<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |