#include<stdio.h>
#include<string.h>
void build(int n,char*s1,char*s2)
{
if(n<=)return ;
int p=strchr(s2,s1[])-s2;///p表示左结点的个数
build(p,s1+,s2);///查找左结点
build(n-p-,s1+p+,s2+p+);///查找右结点
printf("%c",s1[]);///输出每次递归的结点值
}
int main()
{
char s1[],s2[];
memset(s1,,sizeof(s1));
memset(s2,,sizeof(s2));
while(scanf("%s %s",s1,s2)!=EOF)
{
int n=strlen(s1);
build(n,s1,s2);
printf("\n");
}
return ;
}

Tree Recovery的更多相关文章

  1. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

  2. Tree Recovery(前序中序求后序)

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14640   Accepted: 9091 De ...

  3. poj 2255 Tree Recovery 分治

    Tree Recovery Description Little Valentine liked playing with binary trees very much. Her favorite g ...

  4. Tree Recovery POJ - 2255

    Tree Recovery POJ - 2255 根据树的前序遍历和中序遍历还原后序遍历. (偷懒用了stl的find) #include<iostream> #include<st ...

  5. 2018年全国多校算法寒假训练营练习比赛(第五场)H Tree Recovery

    Tree Recovery 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 链接:https://w ...

  6. POJ 2255 Tree Recovery 二叉树的遍历

    前序和中序输入二叉树,后序输出二叉树:核心思想只有一个,前序的每个根都把中序分成了两部分,例如 DBACEGF ABCDEFG D把中序遍历的结果分成了ABC和EFG两部分,实际上,这就是D这个根的左 ...

  7. Tree Recovery(由先、中序列构建二叉树)

    题目来源: http://poj.org/problem?id=2255 题目描述: Description Little Valentine liked playing with binary tr ...

  8. poj 2255 Tree Recovery(求后序遍历,二叉树)

    版权声明:本文为博主原创文章,未经博主同意不得转载.vasttian https://blog.csdn.net/u012860063/article/details/37699219 转载请注明出处 ...

  9. B - Tree Recovery

    Little Valentine liked playing with binary trees very much. Her favorite game was constructing rando ...

  10. UVa 536 Tree Recovery(二叉树后序遍历)

    Little Valentine liked playing with binary trees very much. Her favorite game was constructing rando ...

随机推荐

  1. API设计和命名

    1.前言 对于前端开发而言,肯定会和API打交道,大家也都会想过怎么设计自己的API.优秀的 API 之于代码,就如良好内涵对于每个人.好的 API 不但利于使用者理解,开发时也会事半功倍,后期维护更 ...

  2. boost库的安装

    1.网上下载boost_1_67_0.zip,解压 2.双击boost_1_67_0/bootstrap.bat文件,生成bjam.exe,b2.exe. 3.打开命令行运行 bjam stage - ...

  3. python load mat

    from scipy import io dataset = io.loadmat("a.mat") exclude = ['__globals__', '__header__', ...

  4. MAVEN 创建项目

    使用archetype生成项目骨架 MAVEN 创建项目JAR 和 MAVEN创建项目WAR中是使用特定的acrchetype来进行创建项目,如果使用其他的archetype来创建项目或是使用 mvn ...

  5. learning scala read from file

    scala读文件:   example: scala> import scala.io.Sourceimport scala.io.Source scala> var inputFile ...

  6. HTML中元素的position属性详解

    HTML中元素的position属性详解 转载自:https://blog.csdn.net/wangzunkuan/article/details/81540935   HTML中DOM元素有5种定 ...

  7. Python Django 之 直接执行自定义SQL语句(一)

    一.执行自定义SQL方法 1.Executing custom SQL directly      直接执行自定义SQL,这种方式可以完全避免数据模型,而是直接执行原始的SQL语句. 2.Manage ...

  8. MySQL字符集与校对

    一.什么是字符集与校对 1.字符集与校对 字符集是指一种从二进制编码到某种字符符号的映射. 校队是指一组用于某个字符集的配许规则. 2.utf8与utf8mb4 标准的UTF-8字符集编码是可以使用1 ...

  9. Hive/hbase/sqoop的基本使用教程~

    Hive/hbase/sqoop的基本使用教程~ ###Hbase基本命令start-hbase.sh     #启动hbasehbase shell      #进入hbase编辑命令 list  ...

  10. [Linux]Linux下yaf发送IPV4和IPV6的IPfix

    一.IPFIX与NetFlow 一.IPFIX 全称IP Flow Information Export,即IP流信息输出,是网络流量监测的国际标准.IPFIX是IETF的一个工作组,它的主要工作就是 ...