RE求助
查看原帖
RE求助
690669
Beacon_wolf楼主2024/1/20 14:59
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
int l,d,i,ans;
bool a[21] = {false};
void dfs(int x){
	if(x >= (1 << (d - 1))){
		ans = x;
		return;
	}
	if(a[x] == false) {a[x] = true;dfs(x * 2);}
	else {a[x] = false;dfs(x * 2 + 1);}
}
int main()
{
    cin >> l;
    while(l--){
        memset(a,0,sizeof(a));
		cin >> d >> i;
		for(int j = 1;j <= i;j++) dfs(1);
		cout << ans << endl;
	}
	return 0;
}
2024/1/20 14:59
加载中...