Submission #999793

#TimeUsernameProblemLanguageResultExecution timeMemory
999793ayankarimovaRack (eJOI19_rack)C++14
100 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long const ll sz=2e5+5, mod=1e9+7; ll power(ll a, ll b) { if(b==0) return 1; ll temp=power(a, b/2); if(b%2==0){ return temp%mod*temp%mod; } return (temp%mod*temp%mod*a)%mod; } int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); ll n, k; cin>>n>>k; ll j=n-1, ans=0; //cout<<power(2, 3)<<' '; if(k==1){ cout<<1; return 0; } while(k>1){ if(k%2==0){ ans+=power(2, j); ans%=mod; } k=(k+1)/2; j--; } cout<<ans+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...