제출 #999812

#제출 시각아이디문제언어결과실행 시간메모리
999812hacizadalRack (eJOI19_rack)C++17
100 / 100
2 ms600 KiB
/* :) */ #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define pll pair<ll, ll> #define mod 1000000007 ll power(ll x, ll y) { if (y == 0) return 1; ll k = power(x, y/2); if (y%2==0){ return (k*k)%mod; } else { return (((k*k)%mod)*x)%mod; } } int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); ll n, k, num = 1; cin>>n>>k; for (ll i = n-1; i>=0; i--){ if (k%2==0){ ll x = power(2, i); num += x; num %= mod; k /= 2; } else { k = (k + 1)/2; } } cout<<num; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...