Submission #466154

#TimeUsernameProblemLanguageResultExecution timeMemory
466154okaragulRack (eJOI19_rack)C++17
100 / 100
2 ms204 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define all(aa) aa.begin(), aa.end() #define mod 1'000'000'007 ll fp(int base, int power){ if(!power) return 1; ll res = fp(base, power/2); if(power&1) return res * res % mod * base % mod; else return res * res % mod; } int main(){ ll n, k; cin>>n>>k; ll ans=1; while(n--){ if(k%2==0) ans=(ans+fp(2, n))%mod; k=(k+1)/2; } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...