제출 #448537

#제출 시각아이디문제언어결과실행 시간메모리
448537Tenis0206Rack (eJOI19_rack)C++11
100 / 100
1 ms312 KiB
#include <bits/stdc++.h> using namespace std; const int Mod = 1e9+7; long long lgput(int b, int e) { long long p=1; while(e) { if(e%2==1) { e--; p=(1LL*p*b)%Mod; } else { e/=2; b=(1LL*b*b)%Mod; } } return p; } int main() { ios::sync_with_stdio(false); cin.tie(0); long long n,k; cin>>n>>k; long long rez=1; while(k!=1) { --n; if(k%2==0) { rez+=lgput(2,n); rez%=Mod; } k=(k+1)/2; } cout<<rez<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...