hiho Week 10 register

Ended

Participants:639

Verdict:Accepted
Score:100 / 100
Submitted:2014-09-06 20:05:57

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
#include<stdio.h>
#include<vector>
#include<string>
using namespace std;
#define LarN 1000
void printTree(const char *pre,const char *in,int length){
    if(length<1)return;
    int idx=0;
    while(in[idx]!=pre[0])idx++;
    printTree(pre+1,in,idx);
    printTree(pre+idx+1,in+idx+1,length-idx-1);
    printf("%c",pre[0]);
}
int main(){
    string Pre,In;
    cin>>Pre;
    cin>>In;
    printTree(Pre.c_str(),In.c_str(),Pre.length());
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX