usaco_3_4_2_heritage.cpp
来自「usaco自己做的1到5章的代码」· C++ 代码 · 共 44 行
CPP
44 行
/*
ID: wangyuc2
PROB:heritage
LANG: C++
*/
/*
貌似没什么说滴……已知树的中序和先序序列,求个后序的……
*/
#include <fstream>
#include <iostream>
#include <string>
#include <memory>
#include <algorithm>
#include <bitset>
#include <queue>
#include <vector>
#define MAXV 202
#define MAXE 1000
#define cin fin
using namespace std;
ifstream fin("heritage.in");
ofstream fout("heritage.out");
void lrd(string s1,string s2)
{
int i;
if(s1.size()==0) return;
i=s1.find(s2[0]);
lrd(s1.substr(0,i),s2.substr(1,i));
lrd(s1.substr(i+1),s2.substr(i+1));
fout<<s1[i];
}
int main()
{
int i;
string s1,s2;
cin>>s1;
cin>>s2;
lrd(s1,s2);
fout<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?