这是一种模拟的写法
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int ans[12345],x;
bool f,r;
char ai[12345];
void d() {
while (scanf("%s", ai)!=EOF) {
int v=strlen(ai);
if(v==0) return ;
r=1;
if(v==2) return ;
int i=1;
string temp;
for(; ai[i]!=','; ++i) {
temp=temp+ai[i];
}
i++;
int t=1;
for(; i<v-1; ++i) {
if(ai[i]=='L') t*=2;
else t=t*2+1;
}
x=max(x,t);
int num=0;
int k=temp.size();
for(int j=0; j<k; ++j) {
num+=int(temp[j]-'0')*pow(10,(k-j-1));
}
if(ans[t]) {
f=1;
return ;
}
ans[t]=num;
}r=0;
}
int main() {
while(1) {
memset(ans,0,sizeof(ans));
f=0;
x=0;
r=0;
d();
if(r==0) return 0;
if(f==1) {
cout<<"not complete"<<endl;
continue;
}
if(ans[1]) cout<<ans[1]<<" ";
for(int i=2; i<=x; ++i) {
if(i%2) {
int j=(i-1)/2;
if(ans[j]) if(ans[i]==0) continue;
else
cout<<ans[i]<<" ";
else {
if(!ans[i]) continue;
cout<<"not complete"<<endl;
break;
}
} else {
int j=i/2;
if(ans[j]) if(!ans[i]) continue;
else
cout<<ans[i]<<" ";
else {
if(!ans[i]) continue;
cout<<"not complete"<<endl;
break;
}
}
}
}
}