【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

递归题

【代码】

#include <bits/stdc++.h>
using namespace std; const int N = 300; string s1, s2;
int n, idx;
int g[N][2]; int dfs(int l, int r) {
int temp = l;
for (int i = l; i <= r; i++) {
if (s2[i] == s1[idx]) {
temp = i;
}
}
idx++; if (l <= temp - 1) {
g[(int)s2[temp]][0] = dfs(l, temp-1);
} if (temp + 1 <= r) {
g[(int)s2[temp]][1] = dfs(temp + 1, r);
}
return s2[temp];
} void dfs2(int x) {
if (g[x][0]) {
dfs2(g[x][0]);
}
if (g[x][1]) {
dfs2(g[x][1]);
}
cout << (char)x;
} int main() {
#ifdef LOCAL_DEFINE
freopen("F:\\c++source\\rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0), cin.tie(0);
while (cin >> s1 >> s2) {
memset(g, 0, sizeof g);
n = s1.size();
idx = 0;
dfs2(dfs(0, n - 1));
cout << endl;
}
return 0;
}

最新文章

  1. sudo:有效用户 ID 不是 0,sudo 属于 root 并设置了 setuid 位吗
  2. ReWriteDateControll
  3. 自定义cell侧滑删除
  4. 黑马程序员-循环引用问题和weak
  5. 学习使用 jQuery &amp; CSS3 制作照片堆栈效果
  6. 活学活用,webapi HTTPBasicAuthorize搭建小型云应用的实践
  7. Python超简单的HTTP服务器
  8. ElasticSearch使用IK中文分词---安装步骤记录
  9. spring html特殊字符操作
  10. EJB3Persistence开发手册-原生SQL查询(NativeSQL)
  11. eclipse/myeclipse选中编辑区域文件,Package Explorer定位文件所在项目及目录
  12. 8、第八次课jquery第一节20151006
  13. UML_行为图
  14. poj 2114 Boatherds 树的分治
  15. [LeetCode] Two Sum IV - Input is a BST 两数之和之四 - 输入是二叉搜索树
  16. java客户端调用webService
  17. mybatis中传入String类型参数的问题
  18. SQL中EXPLAIN命令详解
  19. JS常用各种正则表达式(汇总)
  20. Java动态生成类以及动态添加属性

热门文章

  1. JS中部分 Array 对象方法介绍
  2. Scrapy 框架介绍
  3. Python——Pygame实现生命游戏(game of life)
  4. 今日SGU 5.15
  5. Jsp学习总结(1)——JSP九大内置对象和四种属性范围解读
  6. HOJ——T 1867 经理的烦恼
  7. Intersection between 2d conic in OpenCASCADE
  8. vim 基础学习之可视模式
  9. ajax如何上传文件(整理)
  10. C++标准库概述