이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//
// main.cpp
// Hanging Rack
//
// Created by Panagiotis Hadjicostas on 16/05/2020.
// Copyright © 2020 Panagiotis Hadjicostas. All rights reserved.
//
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define MOD ll(1e9+7)
ll din[1000001];
ll reverse1(ll num,ll n)
{
ll b=0;
for (ll i = n - 1; i >= 0&# i--) {
if (num % 2 == 1) {
b=(b+din[i])%MOD;
//cout<<b<<endl;
}
num/=2;
}
return b;
}
int main() {
ll n,k;cin>>n>>k;
din[0]=1;
for(ll i=1;i<1000001;i++){
din[i]=(din[i-1]*2)%MOD;
}
//cout<<'h';
//k--;
cout<<(reverse1(k-1, n)+1)%MOD<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |