This commit is contained in:
Zengtudor 2024-10-23 13:52:32 +08:00
parent 1dc9892842
commit dd20cc9fd8

33
src/P5657/P5657.cpp Normal file
View File

@ -0,0 +1,33 @@
#include <iostream>
using ull = unsigned long long;
ull n,k;
// #define ONLINE_JUDGE
#ifdef ONLINE_JUDGE
#define DEBUG(code)
#else
#define DEBUG(code)code
#endif
int main(){
std::cin>>n>>k;
while(1){
DEBUG(
std::cout<<'\n'<<n<<", "<<k<<'\n';
)
if(n<=1){
std::cout<<k<<'\n';
return 0;
}
const ull next_num = 1ull<<(n-1);
if(k>=next_num){
std::cout<<1;
k-=next_num;
k = next_num-k-1;
}else{
std::cout<<0;
}
--n;
}
}