Submission #592477

#TimeUsernameProblemLanguageResultExecution timeMemory
592477IwanttobreakfreeRack (eJOI19_rack)C++98
100 / 100
1 ms368 KiB
#include <iostream> #include <vector> using namespace std; #define int long long const int mod=1e9+7; int bin_exp(int n,int k){ if(!k)return 1; int x=bin_exp(n,k/2); x=(x*x)%mod; if(k&1)return (x*n)%mod; return x; } signed main(){ int n,x,cnt=1,ans=0; cin>>n>>x; x--; while(x){ if(x&1)ans=(ans+bin_exp(2,n-cnt))%mod; x/=2; cnt++; } cout<<ans+1<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...