题解 | #字符覆盖#
字符覆盖
https://www.nowcoder.com/practice/d7ae059c1cee491989412c4fa39d4384
#include <iostream>
#include<algorithm>
using namespace std;
int work(string& s,string& t)
{
int i=0;
std::sort(t.begin(),t.end(),std::greater<char>());
for(auto& ch : s)
{
if(ch<t[i])
{
ch=t[i];
i++;
}
}
return 0;
}
int main() {
string a, b;
while (cin >> a >> b) { // 注意 while 处理多个 case
work(a,b);
cout << a << endl;
}
}
// 64 位输出请用 printf("%lld")
查看13道真题和解析