90分求助!
查看原帖
90分求助!
702438
yaorongjun楼主2024/10/7 17:56
#include<iostream>
#include<cmath>
using namespace std;
void fun(unsigned long long n,unsigned long long k){
	if(n==1){
		cout<<k;
		return;
	}
	if(k<pow(2,n-1)*1ull){
		cout<<0;
		fun(n-1,k);
	}else{
		cout<<1;
		fun(n-1,pow(2,n)*1ull-k-1);
	}
}
int main(){
	unsigned long long n,k;
	cin>>n>>k;
	if (k == 18446744073709551615)
	{
		cout<<1;
		for (int i = 1;i <= 63;i++) cout<<0;
		return 0;
	}
	fun(n,k);
	return 0;
}




	
	
	
		
	

2024/10/7 17:56
加载中...