字符集的BUG有没有大佬教教怎么避免呀,WA了3个点
查看原帖
字符集的BUG有没有大佬教教怎么避免呀,WA了3个点
787031
UKE_Piu楼主2023/8/20 19:42
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;

	string LDR,DLR;
void tree(string x,string y){
	if(x.empty()) return ;
	char root=x[0];
	int k=y.find(root);
	x.erase(x.begin());
	tree(x.substr(0,k),y.substr(0,k));
	tree(x.substr(k),y.substr(k+1));
	cout<<root;
}

int main(){
	getline(cin,LDR);
	getline(cin,DLR);
	tree(DLR,LDR);
	return 0;
}
2023/8/20 19:42
加载中...