1 条题解

  • 0
    @ 2025-2-14 21:26:47

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    void f(string a, string b) {
    	if (a.size() == 0) return;
    	
    	char root = a[0];
    	int pos = b.find(root);
    	
    	f(a.substr(1, pos), b.substr(0, pos));
    	f(a.substr(pos + 1), b.substr(pos + 1));
    	cout << root;
    }
    
    int main() {
    	string a, b;
    	while (cin >> a >> b) {
    		f(a, b);
    		cout << endl;
    	}
    
    	return 0;
    }
    
    
    • 1

    信息

    ID
    911
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    (无)
    递交数
    0
    已通过
    0
    上传者