제출 #448354

#제출 시각아이디문제언어결과실행 시간메모리
448354mychecksedadRack (eJOI19_rack)C++17
100 / 100
8 ms316 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define MOD (1000000000+7) ll fp(ll a, ll b){ ll res = 1; while(b){ if(b&1) (res*=a)%=MOD; (a*=a)%=MOD; b>>=1; } return res; } int main(){ cin.tie(0); ios::sync_with_stdio(0); ll n, k, ans=1; cin >> n >> k; for(ll i = n-1; i >= 0; i--){ if(k&1){ k = (k>>1) + 1; }else{ k >>= 1; ans += fp(2, i); } (ans%=MOD); (ans+=MOD)%=MOD; } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...