제출 #638738

#제출 시각아이디문제언어결과실행 시간메모리
638738Koful123Rack (eJOI19_rack)C++17
40 / 100
8 ms8148 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const int N = 1e6+6;
int pw[N];

int f(int n,int k){
	if(n == 0) return 1;
	if(k % 2) return f(n-1,k/2+1);
	return pw[n-1] + f(n-1,k/2);
}

void solve(){

	int n,k;
	cin >> n >> k;

	pw[0] = 1;
	for(int i=1;i<N;i++){
		pw[i] = (pw[i-1] * 2) % mod;
	}

	cout << f(n,k) << endl;
}

signed main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	int t = 1;
	//cin >> t;

	while(t--)
		solve();
	
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...