社区讨论
求助!22分,哪里错了?
P1827[USACO3.4] 美国血统 American Heritage参与者 2已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @lo8n6tlm
- 此快照首次捕获于
- 2023/10/27 21:21 2 年前
- 此快照最后确认于
- 2023/10/27 21:21 2 年前
CPP
#include<bits/stdc++.h>
using namespace std;
string x, y;
void dfs(string x, string y)
{
char c = x[0];
int s = x.find(c), len = x.size();
if(s != 0)
{
dfs(x.substr(1, s), y.substr(0, s));
}
if(s + 1 <= len - 1)
{
dfs(x.substr(s + 1), y.substr(s + 1));
}
cout << c;
}
int main()
{
cin >> x >> y;
dfs(y, x);
return 0;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...