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;
long long n,m,cur;
long long MOD = 1e9 + 7;
long long solve(long long a,long long b){
long long ans = 1;
while(b){
if(b % 2 == 1){
ans = ans * a % MOD;
}
a = a * a % MOD;
b /= 2;
}
return ans;
}
long long ans;
int main(){
cin >> n >> m;
cur = n - 1;
while(m != 1){
if(m % 2 == 0){
ans = (ans + solve(2,cur)) % MOD;
}
cur--;
m -= m / 2;
}
cout << ans + 1 << 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... |