标签:二叉树
<img src="http://img.blog.csdn.net/20141014212549703?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvUl9NaXNheWE=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
#include<stdio.h> #include<string.h> int cont; char st1[100],st2[100],ans[100]; void build(int n,char *s1,char *s2,char *s) { if(n<=0) return; int p=strchr(s1,s2[n-1])-s1; ans[cont++]=s2[n-1]; build(p,s1,s2,s); build(n-p-1,s1+p+1,s2+p,s+p); } int main() { int t; scanf("%d",&t); while(t--) { cont=0; scanf("%s%s",st1,st2); int len=strlen(st1); build(len,st1,st2,ans); ans[len]='\0'; printf("%s\n",ans); } return 0; }
标签:二叉树
原文地址:http://blog.csdn.net/r_misaya/article/details/40085127