0
已解决
黄俊博
资深光能
资深光能
#include<iostream>
#include<algorithm>
using namespace std;
int n;
struct Node{
char parent;
char left;
char right;
}tree[1000];
void printxx(char parent)
{
if(parent=='0')
{
return ;
}
for(int i=1;i<=n;i++)
{
if (tree[i].parent==parent)
{
cout<<tree[i].parent;
printxx(tree[i].left);
printxx(tree[i].right);
return ;
}
}
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>tree[i].parent>>tree[i].left>>tree[i].right;
printxx(tree[1].parent);
return 0;
}
0
0
0
0
0
0
0
0
0
0