Submission #290152

#TimeUsernameProblemLanguageResultExecution timeMemory
290152sabamakuRack (eJOI19_rack)C++14
100 / 100
1 ms256 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...