acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • 题解(最简单的版本)

    #include<bits/stdc++.h> using namespace std; string io,po; void dfs(int l1,int r1,int l2,int r2){ if(l1>r1||l2>r2)return; int pos=io.find(po[r1]); int cnt=pos-l2; cout<<po[r1]; dfs(l1,l1+cnt-1,l2,pos-1); dfs(l1+cnt,r1-1,pos+1,r2);} int main(){ cin>>io>>po; int len=io.size()-1; dfs(0,len,0,len); return 0;}

    userId_undefined

    H

    秩序白银
    16阅读
    0回复
    1点赞
  • 题解(最标准的版本)

    userId_undefined

    man(但圣蛋)

    倔强青铜
    9阅读
    0回复
    0点赞
  • 题解

    #include<bits/stdc++.h> using namespace std; void dfs(string s,string t){ if(s.size() == 0) return; int id = s.find(t.back()); cout << s[id]; dfs(s.substr(0, id),t.substr(0,id)); dfs(s.substr(id + 1,s.size() - id - 1),t.substr(id,s.size() - id - 1)); } int main(){ string s,t; cin >> s >> t; dfs(s,t); return 0; }

    userId_undefined

    恶龙世纪

    倔强青铜
    0阅读
    0回复
    0点赞
首页