#include <bits/stdc++.h>
using namespace std;
struct tree{
int l,r;
char v;
}t[300];
void f(int x){
if(x==(int)'*')return;
cout<<t[x].v;
f(t[x].l);
f(t[x].r);
}
int main() {
int n;cin>>n;
char a,b,c,flag;
for(int i=1;i<=n;i++){
cin>>a>>b>>c;if(i==1)flag=(int)a;
int j=(int)a;
t[j].l=(int)b;
t[j].r=(int)c;
t[j].v=(char)a;
}
f(flag);
return 0;
}
就是简单树的建立和遍历,该题注意int和char类型转换和边界为‘*’即可
Anyone use Laser247betting? Is it a good platform for sports betting? Looking for a reliable spot to place my bets. Check it out here: laser247betting
Looking for mwplay88 net and hoping it takes me to the right place. Heard its a decent spot for online gaming adventure. Check out: mwplay88 net
If you like Rummy you gotta check out My Circle Rummy over at mycirclerummy.com! Pretty clean interface and some cool features! Give it a whirl! my circle rummy