#include<bits/stdc++.h>
using namespace std;
struct node{
int id;
bool data;
int father;
int lson,rson;
};
node tree[6000000];
int d,i;
int main(){
cin>>d>>i;
tree[1].father=0;
tree[1].lson=2;
tree[1].rson=3;
tree[1].data=false;
for(int i=2;i<=6000000;i++){
tree[i].lson=i*2;
tree[i].rson=i*2+1;
tree[i].data=false;
tree[i].father=i/2;
}
int n,m;
for(int j=1;j<=i;j++){
n=1;
for(int l=1;l<=d;l++){
if(tree[n].data==false){
m=n;
tree[n].data=true;
n=tree[n].lson;
}else{
m=n;
tree[n].data=false;
n=tree[n].rson;
}
}
}
cout<<m<<endl;
return 0;
}
标签:node,掉落,int,tree,rson,小球,C++,father,lson From: https://blog.csdn.net/qxh10/article/details/140495266