hhh
by 我很辣ji看签名 @ 2018-11-06 16:28:32
麻烦发完整代码
~~或请饶老师教你截图~~
by Hono @ 2018-11-06 16:29:04
@[保登心爱](/space/show?uid=27115)
完整的代码真的不重要的,这部分25莫名变成-1是我关心的部分,不过你想看我就给你吧。
```cpp
#include<string>
using namespace std;
int le[26],ri[26],jud[26];
void go(int i)
{
cout << char('a' + i);
if(le[i]!=-1)go(le[i]);
if (ri[i] != -1)go(ri[i]);
}
int main()
{
int n;
cin >>n;
for (int i = 0; i < n; i++)
{
char a, b, c;
cin >> a >> b >> c;
if (b != '*')le[a - 'a'] = b - 'a';
else le[a - 'a'] = -1;
if (c!= '*')ri[a - 'a'] = c - 'a';
else ri[a - 'a'] = -1;
if(jud[a-'a']!=-1)jud[a - 'a'] = 1;
jud[b - 'a'] = -1;
jud[c - 'a'] = -1;
}
int i;
for (i = 0; i < n; i++)
if (jud[i] == 1)break;
go(i);
return 0;
}
```
by 木守球 @ 2018-11-06 16:34:45
毒
by EtOH_Lewis @ 2019-01-23 16:24:14
我用链表AC了!!!
```
#include<bits/stdc++.h>
using namespace std;
struct node{
char data;
node *next;
};
node *head,*p,*r,*t,*p1,*p2;
int n;
char tmp[3],rt,l,ri;
int main(){
head=new node;
r=new node;
r=head;
scanf("%d\n%c%c%c\n",&n,&tmp[1],&tmp[2],&tmp[3]);
for(int i=1;i<=3;++i){
p=new node;
if(tmp[i]!='*'){
p->data=tmp[i];
p->next=NULL;
r->next=p;
r=p;
}
}
for(int i=2;i<n;++i){
scanf("%c%c%c\n",&rt,&l,&ri);
for(t=head->next;t!=NULL;t=t->next){
if(t->data==rt){
if(l!='*'){
if(t==r){
t->next=new node;
t->next->data=l;
t->next->next=NULL;
r=t->next;
}else{
p1=new node;
p1->data=l;
p1->next=t->next;
t->next=p1;
}
t=t->next;
}
if(ri!='*'){
if(t==r){
t->next=new node;
t=t->next;
t->data=ri;
t->next=NULL;
r=t;
}else{
p2=new node;
p2->data=ri;
p2->next=t->next;
t->next=p2;
}
}
break;
}
}
}
for(p=head->next;p!=NULL;p=p->next)
putchar(p->data);
putchar('\n');
return 0;
}
```
by 持之以珩 @ 2019-02-17 22:35:07
${{binary}^{tree}_{is_{_{not^{^{good}}}}}}$
${link^{list_{can}}_{{do^{a_{_{_{lot}}}}}}}$
by 持之以珩 @ 2019-02-17 22:44:47
${LaTex^{is_{very}}_{good,_{isn't_{it_?}}}}$
by 持之以珩 @ 2019-02-17 22:54:18