0分求助!
查看原帖
0分求助!
768144
_Trangle_楼主2022/9/20 10:09

求各位大佬吗看看我代码是哪的问题?

#include<iostream>
using namespace std;
string b,r;
void dfs(int bs,int be,int rs,int re){
    if(bs>=be) return;
    char ch=r[re];
    cout<<ch;
    int pos=b.substr(bs,be).find(ch);
    dfs(bs,bs+pos-1,rs,rs+pos-1);
    dfs(bs+pos+1,be,rs+pos,re-1);
}

int main(){
    ios::sync_with_stdio(false);
    cin>>b>>r;
    dfs(0,b.size()-1,0,r.size()-1);
    return 0;
}
2022/9/20 10:09
加载中...