제출 #465240

#제출 시각아이디문제언어결과실행 시간메모리
465240Alen777Rack (eJOI19_rack)C++14
100 / 100
18 ms15564 KiB
#include <iostream> #include <string> #include <iomanip> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <cmath> #include <algorithm> #include <cstring> using namespace std; #define ll long long #define ull unsigned ll #define pb push_back #define mpr make_pair #define lb lower_bound #define ld long double #define ub upper_bound ll n, k; vector<ll> ast; ll mod = 1e9 + 7; ll rec(ll n, ll k) { if (n == 0) { return 1; } if (k % 2LL) { return rec(n - 1LL, (k + 1LL) / 2LL); } else { return (rec(n - 1LL, k / 2LL) + ast[n - 1]) % mod; } } void solve() { cin >> n >> k; vector<ll> x(n, 1); ast = x; for(int i = 1; i < n; i++) { ast[i] = (ast[i - 1] * 2) % mod; } cout << rec(n, k) << endl; } int main() { /*cout.setf(ios::fixed | ios::showpoint); cout.precision(6);*/ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...